diff options
| author | 2024-11-24 09:25:59 +0100 | |
|---|---|---|
| committer | 2024-11-24 09:25:59 +0100 | |
| commit | 93f70d6759e0bc67326ca78283cd9627f8ca4580 (patch) | |
| tree | baa7378f3340d29768d2290bfda5603831363c38 | |
| parent | New web actions "Approve" and "Discard". (diff) | |
| download | snac2-93f70d6759e0bc67326ca78283cd9627f8ca4580.tar.gz snac2-93f70d6759e0bc67326ca78283cd9627f8ca4580.tar.xz snac2-93f70d6759e0bc67326ca78283cd9627f8ca4580.zip | |
Added web UI for the 'approve_followers' checkbox.
| -rw-r--r-- | html.c | 14 |
1 files changed, 14 insertions, 0 deletions
| @@ -1049,6 +1049,7 @@ xs_html *html_top_controls(snac *snac) | |||
| 1049 | const xs_val *a_private = xs_dict_get(snac->config, "private"); | 1049 | const xs_val *a_private = xs_dict_get(snac->config, "private"); |
| 1050 | const xs_val *auto_boost = xs_dict_get(snac->config, "auto_boost"); | 1050 | const xs_val *auto_boost = xs_dict_get(snac->config, "auto_boost"); |
| 1051 | const xs_val *coll_thrds = xs_dict_get(snac->config, "collapse_threads"); | 1051 | const xs_val *coll_thrds = xs_dict_get(snac->config, "collapse_threads"); |
| 1052 | const xs_val *pending = xs_dict_get(snac->config, "approve_followers"); | ||
| 1052 | 1053 | ||
| 1053 | xs *metadata = NULL; | 1054 | xs *metadata = NULL; |
| 1054 | const xs_dict *md = xs_dict_get(snac->config, "metadata"); | 1055 | const xs_dict *md = xs_dict_get(snac->config, "metadata"); |
| @@ -1221,6 +1222,15 @@ xs_html *html_top_controls(snac *snac) | |||
| 1221 | xs_html_attr("for", "collapse_threads"), | 1222 | xs_html_attr("for", "collapse_threads"), |
| 1222 | xs_html_text(L("Collapse top threads by default")))), | 1223 | xs_html_text(L("Collapse top threads by default")))), |
| 1223 | xs_html_tag("p", | 1224 | xs_html_tag("p", |
| 1225 | xs_html_sctag("input", | ||
| 1226 | xs_html_attr("type", "checkbox"), | ||
| 1227 | xs_html_attr("name", "approve_followers"), | ||
| 1228 | xs_html_attr("id", "approve_followers"), | ||
| 1229 | xs_html_attr(xs_is_true(pending) ? "checked" : "", NULL)), | ||
| 1230 | xs_html_tag("label", | ||
| 1231 | xs_html_attr("for", "approve_followers"), | ||
| 1232 | xs_html_text(L("Follow requests must be approved")))), | ||
| 1233 | xs_html_tag("p", | ||
| 1224 | xs_html_text(L("Profile metadata (key=value pairs in each line):")), | 1234 | xs_html_text(L("Profile metadata (key=value pairs in each line):")), |
| 1225 | xs_html_sctag("br", NULL), | 1235 | xs_html_sctag("br", NULL), |
| 1226 | xs_html_tag("textarea", | 1236 | xs_html_tag("textarea", |
| @@ -3786,6 +3796,10 @@ int html_post_handler(const xs_dict *req, const char *q_path, | |||
| 3786 | snac.config = xs_dict_set(snac.config, "collapse_threads", xs_stock(XSTYPE_TRUE)); | 3796 | snac.config = xs_dict_set(snac.config, "collapse_threads", xs_stock(XSTYPE_TRUE)); |
| 3787 | else | 3797 | else |
| 3788 | snac.config = xs_dict_set(snac.config, "collapse_threads", xs_stock(XSTYPE_FALSE)); | 3798 | snac.config = xs_dict_set(snac.config, "collapse_threads", xs_stock(XSTYPE_FALSE)); |
| 3799 | if ((v = xs_dict_get(p_vars, "approve_followers")) != NULL && strcmp(v, "on") == 0) | ||
| 3800 | snac.config = xs_dict_set(snac.config, "approve_followers", xs_stock(XSTYPE_TRUE)); | ||
| 3801 | else | ||
| 3802 | snac.config = xs_dict_set(snac.config, "approve_followers", xs_stock(XSTYPE_FALSE)); | ||
| 3789 | 3803 | ||
| 3790 | if ((v = xs_dict_get(p_vars, "metadata")) != NULL) | 3804 | if ((v = xs_dict_get(p_vars, "metadata")) != NULL) |
| 3791 | snac.config = xs_dict_set(snac.config, "metadata", v); | 3805 | snac.config = xs_dict_set(snac.config, "metadata", v); |