summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar green2025-04-12 21:56:23 +0200
committerGravatar green2026-01-24 02:23:16 +0100
commit50129db64b70604d347c2f21be5e5182080c6e07 (patch)
treec1753b574db1052897276b4180ef57854f437260
parentMerge pull request 'add susie-q (qr) to artwork' (#528) from pmjv/snac2:maste... (diff)
downloadsnac2-50129db64b70604d347c2f21be5e5182080c6e07.tar.gz
snac2-50129db64b70604d347c2f21be5e5182080c6e07.tar.xz
snac2-50129db64b70604d347c2f21be5e5182080c6e07.zip
small: configurable poll limit
-rw-r--r--activitypub.c4
-rw-r--r--html.c6
2 files changed, 9 insertions, 1 deletions
diff --git a/activitypub.c b/activitypub.c
index c34e510..2890a94 100644
--- a/activitypub.c
+++ b/activitypub.c
@@ -2322,8 +2322,12 @@ xs_dict *msg_question(snac *user, const char *content, xs_list *attach,
2322{ 2322{
2323 xs_dict *msg = msg_note(user, content, NULL, NULL, attach, 0, NULL, NULL); 2323 xs_dict *msg = msg_note(user, content, NULL, NULL, attach, 0, NULL, NULL);
2324 int max = 8; 2324 int max = 8;
2325 const xs_number *max_options = xs_dict_get(srv_config, "max_poll_options");
2325 xs_set seen; 2326 xs_set seen;
2326 2327
2328 if (xs_type(max_options) == XSTYPE_NUMBER)
2329 max = xs_number_get(max_options);
2330
2327 msg = xs_dict_set(msg, "type", "Question"); 2331 msg = xs_dict_set(msg, "type", "Question");
2328 2332
2329 /* make it non-editable */ 2333 /* make it non-editable */
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,
778 778
779 /* add poll controls */ 779 /* add poll controls */
780 if (poll) { 780 if (poll) {
781 const xs_number *max_options = xs_dict_get(srv_config, "max_poll_options");
782 xs *poll_limit_str = xs_dup(L("Poll options (one per line, up to 8):"));
783 poll_limit_str = xs_replace_i(poll_limit_str, "8", xs_number_str(max_options));
784
781 xs_html_add(form, 785 xs_html_add(form,
782 xs_html_tag("p", NULL), 786 xs_html_tag("p", NULL),
783 xs_html_tag("details", 787 xs_html_tag("details",
784 xs_html_tag("summary", 788 xs_html_tag("summary",
785 xs_html_text(L("Poll..."))), 789 xs_html_text(L("Poll..."))),
786 xs_html_tag("p", 790 xs_html_tag("p",
787 xs_html_text(L("Poll options (one per line, up to 8):")), 791 xs_html_text(poll_limit_str),
788 xs_html_sctag("br", NULL), 792 xs_html_sctag("br", NULL),
789 xs_html_tag("textarea", 793 xs_html_tag("textarea",
790 xs_html_attr("class", "snac-textarea"), 794 xs_html_attr("class", "snac-textarea"),