aboutsummaryrefslogtreecommitdiff
path: root/html.c
diff options
context:
space:
mode:
authorgrunfink <grunfink@noreply.codeberg.org>2026-01-25 10:20:35 +0100
committergrunfink <grunfink@noreply.codeberg.org>2026-01-25 10:20:35 +0100
commitd30472f0d96bc9e2659db1cfe55ecf439796b989 (patch)
treeabef499186bdd8d84741f5979fb6964ff31cfc02 /html.c
parent27ca16011e4945ddc0d3e113840ace1a589011e1 (diff)
parenta14cf4a7dbbf6ee90ef8ff4974e7fe9a023d6e48 (diff)
Merge pull request 'Configurable limits for polls' (#534) from dandelions/snac2:poll-limits into master
Reviewed-on: https://codeberg.org/grunfink/snac2/pulls/534
Diffstat (limited to 'html.c')
-rw-r--r--html.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/html.c b/html.c
index 93dba0a..436995b 100644
--- a/html.c
+++ b/html.c
@@ -778,13 +778,18 @@ xs_html *html_note(snac *user, const char *summary,
/* add poll controls */
if (poll) {
+ const xs_number *max_options = xs_dict_get(srv_config, "max_poll_options");
+ xs *poll_limit_str = xs_dup(L("Poll options (one per line, up to 8):"));
+ if (max_options != NULL)
+ poll_limit_str = xs_replace_i(poll_limit_str, "8", xs_number_str(max_options));
+
xs_html_add(form,
xs_html_tag("p", NULL),
xs_html_tag("details",
xs_html_tag("summary",
xs_html_text(L("Poll..."))),
xs_html_tag("p",
- xs_html_text(L("Poll options (one per line, up to 8):")),
+ xs_html_text(poll_limit_str),
xs_html_sctag("br", NULL),
xs_html_tag("textarea",
xs_html_attr("class", "snac-textarea"),
@@ -812,7 +817,13 @@ xs_html *html_note(snac *user, const char *summary,
xs_html_text(L("End in 1 hour"))),
xs_html_tag("option",
xs_html_attr("value", "86400"),
- xs_html_text(L("End in 1 day"))))));
+ xs_html_text(L("End in 1 day"))),
+ xs_html_tag("option",
+ xs_html_attr("value", "259200"),
+ xs_html_text(L("End in 3 days"))),
+ xs_html_tag("option",
+ xs_html_attr("value", "31536000"),
+ xs_html_text(L("End in 1 year"))))));
}
xs_html_add(form,