commit 93f70d6759e0bc67326ca78283cd9627f8ca4580
parent 0db1cf05d1013f9b1e972ae79822f9eda4dede59
Author: default <nobody@localhost>
Date: Sun, 24 Nov 2024 09:25:59 +0100
Added web UI for the 'approve_followers' checkbox.
Diffstat:
1 file changed, 14 insertions(+), 0 deletions(-)
diff --git a/html.c b/html.c
@@ -1049,6 +1049,7 @@ xs_html *html_top_controls(snac *snac)
const xs_val *a_private = xs_dict_get(snac->config, "private");
const xs_val *auto_boost = xs_dict_get(snac->config, "auto_boost");
const xs_val *coll_thrds = xs_dict_get(snac->config, "collapse_threads");
+ const xs_val *pending = xs_dict_get(snac->config, "approve_followers");
xs *metadata = NULL;
const xs_dict *md = xs_dict_get(snac->config, "metadata");
@@ -1221,6 +1222,15 @@ xs_html *html_top_controls(snac *snac)
xs_html_attr("for", "collapse_threads"),
xs_html_text(L("Collapse top threads by default")))),
xs_html_tag("p",
+ xs_html_sctag("input",
+ xs_html_attr("type", "checkbox"),
+ xs_html_attr("name", "approve_followers"),
+ xs_html_attr("id", "approve_followers"),
+ xs_html_attr(xs_is_true(pending) ? "checked" : "", NULL)),
+ xs_html_tag("label",
+ xs_html_attr("for", "approve_followers"),
+ xs_html_text(L("Follow requests must be approved")))),
+ xs_html_tag("p",
xs_html_text(L("Profile metadata (key=value pairs in each line):")),
xs_html_sctag("br", NULL),
xs_html_tag("textarea",
@@ -3786,6 +3796,10 @@ int html_post_handler(const xs_dict *req, const char *q_path,
snac.config = xs_dict_set(snac.config, "collapse_threads", xs_stock(XSTYPE_TRUE));
else
snac.config = xs_dict_set(snac.config, "collapse_threads", xs_stock(XSTYPE_FALSE));
+ if ((v = xs_dict_get(p_vars, "approve_followers")) != NULL && strcmp(v, "on") == 0)
+ snac.config = xs_dict_set(snac.config, "approve_followers", xs_stock(XSTYPE_TRUE));
+ else
+ snac.config = xs_dict_set(snac.config, "approve_followers", xs_stock(XSTYPE_FALSE));
if ((v = xs_dict_get(p_vars, "metadata")) != NULL)
snac.config = xs_dict_set(snac.config, "metadata", v);