commit b55dbf1

default  ·  2023-07-04 12:50:09 +0000 UTC
parent f29986f
The sensitive content can have a description.
1 files changed,  +11, -4
M html.c
M html.c
+11, -4
 1@@ -387,7 +387,8 @@ d_char *html_top_controls(snac *snac, d_char *s)
 2         "<textarea class=\"snac-textarea\" name=\"content\" "
 3         "rows=\"8\" wrap=\"virtual\" required=\"required\"></textarea>\n"
 4         "<input type=\"hidden\" name=\"in_reply_to\" value=\"\">\n"
 5-        "<p>%s: <input type=\"checkbox\" name=\"sensitive\">\n"
 6+        "<p>%s: <input type=\"checkbox\" name=\"sensitive\"> "
 7+        "<input type=\"text\" name=\"summary\" placeholder=\"%s\">\n"
 8         "<p>%s: <input type=\"checkbox\" name=\"mentioned_only\">\n"
 9 
10         "<details><summary>%s</summary>\n" /** attach **/
11@@ -512,6 +513,7 @@ d_char *html_top_controls(snac *snac, d_char *s)
12     xs *s1 = xs_fmt(_tmpl,
13         snac->actor,
14         L("Sensitive content"),
15+        L("Sensitive content description"),
16         L("Only for mentioned people"),
17 
18         L("Attach..."),
19@@ -697,7 +699,8 @@ xs_str *html_entry_controls(snac *snac, xs_str *os, const xs_dict *msg, const ch
20             "rows=\"4\" wrap=\"virtual\" required=\"required\">%s</textarea>\n"
21             "<input type=\"hidden\" name=\"edit_id\" value=\"%s\">\n"
22 
23-            "<p>%s: <input type=\"checkbox\" name=\"sensitive\">\n"
24+            "<p>%s: <input type=\"checkbox\" name=\"sensitive\"> "
25+            "<input type=\"text\" name=\"summary\" placeholder=\"%s\">\n"
26             "<p>%s: <input type=\"checkbox\" name=\"mentioned_only\">\n"
27 
28             "<details><summary>%s</summary>\n"
29@@ -717,6 +720,7 @@ xs_str *html_entry_controls(snac *snac, xs_str *os, const xs_dict *msg, const ch
30             prev_src,
31             id,
32             L("Sensitive content"),
33+            L("Sensitive content description"),
34             L("Only for mentioned people"),
35             L("Attach..."),
36             L("File"),
37@@ -741,7 +745,8 @@ xs_str *html_entry_controls(snac *snac, xs_str *os, const xs_dict *msg, const ch
38             "rows=\"4\" wrap=\"virtual\" required=\"required\">%s</textarea>\n"
39             "<input type=\"hidden\" name=\"in_reply_to\" value=\"%s\">\n"
40 
41-            "<p>%s: <input type=\"checkbox\" name=\"sensitive\">\n"
42+            "<p>%s: <input type=\"checkbox\" name=\"sensitive\"> "
43+            "<input type=\"text\" name=\"summary\" placeholder=\"%s\">\n"
44             "<p>%s: <input type=\"checkbox\" name=\"mentioned_only\">\n"
45 
46             "<details><summary>%s</summary>\n"
47@@ -761,6 +766,7 @@ xs_str *html_entry_controls(snac *snac, xs_str *os, const xs_dict *msg, const ch
48             ct,
49             id,
50             L("Sensitive content"),
51+            L("Sensitive content description"),
52             L("Only for mentioned people"),
53             L("Attach..."),
54             L("File"),
55@@ -1846,6 +1852,7 @@ int html_post_handler(const xs_dict *req, const char *q_path,
56         xs_list *attach_file = xs_dict_get(p_vars, "attach");
57         xs_str *to           = xs_dict_get(p_vars, "to");
58         xs_str *sensitive    = xs_dict_get(p_vars, "sensitive");
59+        xs_str *summary      = xs_dict_get(p_vars, "summary");
60         xs_str *edit_id      = xs_dict_get(p_vars, "edit_id");
61         xs_str *alt_text     = xs_dict_get(p_vars, "alt_text");
62         int priv             = !xs_is_null(xs_dict_get(p_vars, "mentioned_only"));
63@@ -1924,7 +1931,7 @@ int html_post_handler(const xs_dict *req, const char *q_path,
64 
65             if (sensitive != NULL) {
66                 msg = xs_dict_set(msg, "sensitive", xs_stock_true);
67-                msg = xs_dict_set(msg, "summary",   "...");
68+                msg = xs_dict_set(msg, "summary",   xs_is_null(summary) ? "..." : summary);
69             }
70 
71             if (xs_is_null(edit_id)) {