commit 339fe5e

default  ·  2023-07-04 12:55:24 +0000 UTC
parent b55dbf1
Also fill the sensitive content fields in the edit dialog.
1 files changed,  +6, -2
M html.c
M html.c
+6, -2
 1@@ -688,6 +688,8 @@ xs_str *html_entry_controls(snac *snac, xs_str *os, const xs_dict *msg, const ch
 2 
 3     if (!xs_is_null(prev_src1) && strcmp(actor, snac->actor) == 0) {
 4         xs *prev_src = xs_replace(prev_src1, "<", "&lt;");
 5+        const xs_val *sensitive = xs_dict_get(msg, "sensitive");
 6+        const char *summary = xs_dict_get(msg, "summary");
 7 
 8         /* post can be edited */
 9         xs *s1 = xs_fmt(
10@@ -699,8 +701,8 @@ xs_str *html_entry_controls(snac *snac, xs_str *os, const xs_dict *msg, const ch
11             "rows=\"4\" wrap=\"virtual\" required=\"required\">%s</textarea>\n"
12             "<input type=\"hidden\" name=\"edit_id\" value=\"%s\">\n"
13 
14-            "<p>%s: <input type=\"checkbox\" name=\"sensitive\"> "
15-            "<input type=\"text\" name=\"summary\" placeholder=\"%s\">\n"
16+            "<p>%s: <input type=\"checkbox\" name=\"sensitive\" %s> "
17+            "<input type=\"text\" name=\"summary\" placeholder=\"%s\" value=\"%s\">\n"
18             "<p>%s: <input type=\"checkbox\" name=\"mentioned_only\">\n"
19 
20             "<details><summary>%s</summary>\n"
21@@ -720,7 +722,9 @@ xs_str *html_entry_controls(snac *snac, xs_str *os, const xs_dict *msg, const ch
22             prev_src,
23             id,
24             L("Sensitive content"),
25+            xs_type(sensitive) == XSTYPE_TRUE ? "checked" : "",
26             L("Sensitive content description"),
27+            summary,
28             L("Only for mentioned people"),
29             L("Attach..."),
30             L("File"),