diff --git a/dist/treebird.css b/dist/treebird.css
index 4e998ea..01b1932 100644
--- a/dist/treebird.css
+++ b/dist/treebird.css
@@ -14,7 +14,6 @@ html
{
background-attachment: fixed !important;
background-size: cover !important;
- background-color: unset !important;
background-color: #eee;
}
@@ -936,6 +935,7 @@ svg.in-reply-to-icon
font-weight: bold;
text-overflow: ellipsis;
white-space: nowrap;
+ vertical-align: middle;
min-width: 0;
}
@@ -1414,6 +1414,11 @@ p}
background-color: #d3d3d3;
}
+.statusbox .post-group input[type=radio].hidden:disabled + .visibility-icon
+{
+ display: none;
+}
+
.statusbox .post-group input[type=radio].hidden:checked + .visibility-icon svg
{
stroke: #000;
diff --git a/src/reply.c b/src/reply.c
index 2b59ef8..7203cde 100644
--- a/src/reply.c
+++ b/src/reply.c
@@ -31,21 +31,40 @@
#define ID_REPLY_SIZE 256
#define ID_RESPONSE ""
-char* construct_post_box(char* reply_id,
+char* construct_post_box(struct mstdnt_status* reply_status,
char* default_content,
size_t* size)
{
+#define C_S "checked"
+#define D_S "disabled"
char* reply_html;
char id_reply[ID_REPLY_SIZE];
+ enum mstdnt_visibility_type vis = MSTDNT_VISIBILITY_PUBLIC;
- // Put hidden post request
- snprintf(id_reply, ID_REPLY_SIZE, ID_RESPONSE, reply_id);
+ // Put hidden post request and check visibility
+ if (reply_status)
+ {
+ snprintf(id_reply, ID_REPLY_SIZE, ID_RESPONSE, reply_status->id);
+ vis = reply_status->visibility;
+ }
- // Construct box
+ /*
+ * Mastodont-c orders the visibility type from smallest (PUBLIC) to
+ * largest (LOCAL), so we take advantage of the enum values
+ */
struct post_template tdata = {
.prefix = config_url_prefix,
- .reply_input = reply_id ? id_reply : NULL,
- .content = default_content
+ .reply_input = reply_status ? id_reply : NULL,
+ .content = default_content,
+ .public_checked = vis == MSTDNT_VISIBILITY_PUBLIC ? C_S : NULL,
+ // You can reply with public to unlisted posts
+ .public_disabled = vis > MSTDNT_VISIBILITY_UNLISTED ? D_S : NULL,
+ .unlisted_checked = vis == MSTDNT_VISIBILITY_UNLISTED ? C_S : NULL,
+ .unlisted_disabled = vis > MSTDNT_VISIBILITY_UNLISTED ? D_S : NULL,
+ .private_checked = vis == MSTDNT_VISIBILITY_PRIVATE ? C_S : NULL,
+ .private_disabled = vis > MSTDNT_VISIBILITY_PRIVATE ? D_S : NULL,
+ .direct_checked = vis == MSTDNT_VISIBILITY_DIRECT ? C_S : NULL,
+ .local_checked = vis == MSTDNT_VISIBILITY_LOCAL ? C_S : NULL,
};
return tmpl_gen_post(&tdata, size);
}
@@ -54,9 +73,9 @@ char* construct_post_box(char* reply_id,
* - Misskey does not return , but we still regex to make sure it's a highlight
* - The order of parameters in a tag can be changed (mastodon does this),
* so we just grep for regex href
- * - Misskey/Mastodon adds an @ symbol in the href param, while pleroma adds /users
+ * - Misskey/Mastodon adds an @ symbol in the href param, while pleroma adds /users and honk adds /u
*/
-#define REGEX_REPLY "@(?:)?.*?(?:<\\/span>)?"
+#define REGEX_REPLY "@(?:)?.*?(?:<\\/span>)?"
char* reply_status(struct session* ssn, char* id, struct mstdnt_status* status)
{
@@ -156,7 +175,7 @@ char* reply_status(struct session* ssn, char* id, struct mstdnt_status* status)
pcre2_match_data_free(re_data);
- stat_reply = construct_post_box(id, replies, NULL);
+ stat_reply = construct_post_box(status, replies, NULL);
pcre2_code_free(re);
free(replies);
free(instance_domain);
diff --git a/src/reply.h b/src/reply.h
index f20c4c7..b01c6be 100644
--- a/src/reply.h
+++ b/src/reply.h
@@ -22,7 +22,7 @@
#include
#include
-char* construct_post_box(char* reply_id,
+char* construct_post_box(struct mstdnt_status* reply_id,
char* default_content,
size_t* size);
diff --git a/static/post.tmpl b/static/post.tmpl
index dd5e9d1..bab0c3a 100644
--- a/static/post.tmpl
+++ b/static/post.tmpl
@@ -5,7 +5,7 @@