From 50129db64b70604d347c2f21be5e5182080c6e07 Mon Sep 17 00:00:00 2001 From: green Date: Sat, 12 Apr 2025 21:56:23 +0200 Subject: small: configurable poll limit --- html.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'html.c') diff --git a/html.c b/html.c index 3f5435c..1a7162f 100644 --- a/html.c +++ b/html.c @@ -778,13 +778,17 @@ 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):")); + 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"), -- cgit v1.2.3 From 207d9e0f01b1703ed55b00825ef65be49576254b Mon Sep 17 00:00:00 2001 From: green Date: Sun, 13 Apr 2025 21:23:01 +0200 Subject: small: fix segfault for poll options --- html.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'html.c') diff --git a/html.c b/html.c index 1a7162f..9de51d1 100644 --- a/html.c +++ b/html.c @@ -780,7 +780,8 @@ xs_html *html_note(snac *user, const char *summary, 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):")); - poll_limit_str = xs_replace_i(poll_limit_str, "8", xs_number_str(max_options)); + 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), -- cgit v1.2.3 From ce8e11adc74015931d9adac6f3b108e7ec31fbf5 Mon Sep 17 00:00:00 2001 From: green Date: Mon, 5 May 2025 22:52:50 +0200 Subject: personal: bigger limit for polls --- html.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'html.c') diff --git a/html.c b/html.c index 9de51d1..77ffda9 100644 --- a/html.c +++ b/html.c @@ -817,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, @@ -3207,6 +3213,7 @@ xs_html *html_entry(snac *user, xs_dict *msg, int read_only, xs_html *add_hashtags = xs_html_tag("ul", xs_html_attr("class", "snac-more-hashtags")); + // todo: wafrn hashtags xs_list_foreach(tags, tag) { const char *type = xs_dict_get(tag, "type"); @@ -3857,6 +3864,8 @@ xs_html *html_people_list(snac *user, xs_list *list, const char *header, const c xs_free(xs_html_render(snac_metadata)); } + // todo: add metadata from "attachemnt"->"PropertyValue" + /* buttons */ xs *btn_form_action = xs_fmt("%s/admin/action", user->actor); -- cgit v1.2.3 From a14cf4a7dbbf6ee90ef8ff4974e7fe9a023d6e48 Mon Sep 17 00:00:00 2001 From: green Date: Sun, 25 Jan 2026 00:30:38 +0100 Subject: poll-limits: revert accidentally commited changes --- html.c | 3 --- 1 file changed, 3 deletions(-) (limited to 'html.c') diff --git a/html.c b/html.c index 77ffda9..0ee4d71 100644 --- a/html.c +++ b/html.c @@ -3213,7 +3213,6 @@ xs_html *html_entry(snac *user, xs_dict *msg, int read_only, xs_html *add_hashtags = xs_html_tag("ul", xs_html_attr("class", "snac-more-hashtags")); - // todo: wafrn hashtags xs_list_foreach(tags, tag) { const char *type = xs_dict_get(tag, "type"); @@ -3864,8 +3863,6 @@ xs_html *html_people_list(snac *user, xs_list *list, const char *header, const c xs_free(xs_html_render(snac_metadata)); } - // todo: add metadata from "attachemnt"->"PropertyValue" - /* buttons */ xs *btn_form_action = xs_fmt("%s/admin/action", user->actor); -- cgit v1.2.3