commit 93f70d6

default  ·  2024-11-24 08:25:59 +0000 UTC
parent 0db1cf0
Added web UI for the 'approve_followers' checkbox.
1 files changed,  +14, -0
M html.c
M html.c
+14, -0
 1@@ -1049,6 +1049,7 @@ xs_html *html_top_controls(snac *snac)
 2     const xs_val *a_private = xs_dict_get(snac->config, "private");
 3     const xs_val *auto_boost = xs_dict_get(snac->config, "auto_boost");
 4     const xs_val *coll_thrds = xs_dict_get(snac->config, "collapse_threads");
 5+    const xs_val *pending    = xs_dict_get(snac->config, "approve_followers");
 6 
 7     xs *metadata = NULL;
 8     const xs_dict *md = xs_dict_get(snac->config, "metadata");
 9@@ -1220,6 +1221,15 @@ xs_html *html_top_controls(snac *snac)
10                     xs_html_tag("label",
11                         xs_html_attr("for", "collapse_threads"),
12                         xs_html_text(L("Collapse top threads by default")))),
13+                xs_html_tag("p",
14+                    xs_html_sctag("input",
15+                        xs_html_attr("type", "checkbox"),
16+                        xs_html_attr("name", "approve_followers"),
17+                        xs_html_attr("id",   "approve_followers"),
18+                        xs_html_attr(xs_is_true(pending) ? "checked" : "", NULL)),
19+                    xs_html_tag("label",
20+                        xs_html_attr("for", "approve_followers"),
21+                        xs_html_text(L("Follow requests must be approved")))),
22                 xs_html_tag("p",
23                     xs_html_text(L("Profile metadata (key=value pairs in each line):")),
24                     xs_html_sctag("br", NULL),
25@@ -3786,6 +3796,10 @@ int html_post_handler(const xs_dict *req, const char *q_path,
26             snac.config = xs_dict_set(snac.config, "collapse_threads", xs_stock(XSTYPE_TRUE));
27         else
28             snac.config = xs_dict_set(snac.config, "collapse_threads", xs_stock(XSTYPE_FALSE));
29+        if ((v = xs_dict_get(p_vars, "approve_followers")) != NULL && strcmp(v, "on") == 0)
30+            snac.config = xs_dict_set(snac.config, "approve_followers", xs_stock(XSTYPE_TRUE));
31+        else
32+            snac.config = xs_dict_set(snac.config, "approve_followers", xs_stock(XSTYPE_FALSE));
33 
34         if ((v = xs_dict_get(p_vars, "metadata")) != NULL)
35             snac.config = xs_dict_set(snac.config, "metadata", v);