commit 8a39223

default  ·  2023-07-04 13:02:04 +0000 UTC
parent 339fe5e
The content warning check and description is propagated from the replied message.
1 files changed,  +10, -5
M html.c
M html.c
+10, -5
 1@@ -686,7 +686,7 @@ xs_str *html_entry_controls(snac *snac, xs_str *os, const xs_dict *msg, const ch
 2 
 3     const char *prev_src1 = xs_dict_get(msg, "sourceContent");
 4 
 5-    if (!xs_is_null(prev_src1) && strcmp(actor, snac->actor) == 0) {
 6+    if (!xs_is_null(prev_src1) && strcmp(actor, snac->actor) == 0) { /** edit **/
 7         xs *prev_src = xs_replace(prev_src1, "<", "&lt;");
 8         const xs_val *sensitive = xs_dict_get(msg, "sensitive");
 9         const char *summary = xs_dict_get(msg, "summary");
10@@ -724,7 +724,7 @@ xs_str *html_entry_controls(snac *snac, xs_str *os, const xs_dict *msg, const ch
11             L("Sensitive content"),
12             xs_type(sensitive) == XSTYPE_TRUE ? "checked" : "",
13             L("Sensitive content description"),
14-            summary,
15+            xs_is_null(summary) ? "" : summary,
16             L("Only for mentioned people"),
17             L("Attach..."),
18             L("File"),
19@@ -736,10 +736,13 @@ xs_str *html_entry_controls(snac *snac, xs_str *os, const xs_dict *msg, const ch
20         s = xs_str_cat(s, s1);
21     }
22 
23-    {
24+    { /** reply **/
25         /* the post textarea */
26         xs *ct = build_mentions(snac, msg);
27 
28+        const xs_val *sensitive = xs_dict_get(msg, "sensitive");
29+        const char *summary = xs_dict_get(msg, "summary");
30+
31         xs *s1 = xs_fmt(
32             "<p><details><summary>%s</summary>\n"
33             "<p><div class=\"snac-note\" id=\"%s_reply\">\n"
34@@ -749,8 +752,8 @@ xs_str *html_entry_controls(snac *snac, xs_str *os, const xs_dict *msg, const ch
35             "rows=\"4\" wrap=\"virtual\" required=\"required\">%s</textarea>\n"
36             "<input type=\"hidden\" name=\"in_reply_to\" value=\"%s\">\n"
37 
38-            "<p>%s: <input type=\"checkbox\" name=\"sensitive\"> "
39-            "<input type=\"text\" name=\"summary\" placeholder=\"%s\">\n"
40+            "<p>%s: <input type=\"checkbox\" name=\"sensitive\" %s> "
41+            "<input type=\"text\" name=\"summary\" placeholder=\"%s\" value=\"%s\">\n"
42             "<p>%s: <input type=\"checkbox\" name=\"mentioned_only\">\n"
43 
44             "<details><summary>%s</summary>\n"
45@@ -770,7 +773,9 @@ xs_str *html_entry_controls(snac *snac, xs_str *os, const xs_dict *msg, const ch
46             ct,
47             id,
48             L("Sensitive content"),
49+            xs_type(sensitive) == XSTYPE_TRUE ? "checked" : "",
50             L("Sensitive content description"),
51+            xs_is_null(summary) ? "" : summary,
52             L("Only for mentioned people"),
53             L("Attach..."),
54             L("File"),