Poll WIP (#231):

* frontend WIP
* backend fix
This commit is contained in:
John Livingston
2024-07-04 15:15:28 +02:00
parent 4168b2ce41
commit ffb8ac8ddc
8 changed files with 127 additions and 18 deletions

View File

@ -29,3 +29,5 @@ Here are the existing strings and default values:
* poll_string_over: This poll is now over.
* poll_string_vote_instructions: Send a message with an exclamation mark followed by your choice number to vote. Example: !1
* poll_string_invalid_choice: This choice is not valid.
* poll_string_anonymous_vote_ok: You vote is taken into account. Votes are anonymous, it will not be shown to other participants.

View File

@ -11,6 +11,9 @@ local poll_start_message = module:require("message").poll_start_message;
local poll_end_message = module:require("message").poll_end_message;
local schedule_poll_update_message = module:require("message").schedule_poll_update_message;
local string_poll_invalid_choice = module:get_option_string("poll_string_invalid_choice") or "This choice is not valid.";
local string_poll_anonymous_vote_ok = module:get_option_string("poll_string_anonymous_vote_ok") or "You vote is taken into account. Votes are anonymous, it will not be shown to other participants.";
local scheduled_end = {};
local function schedule_poll_purge(room_jid)
@ -171,7 +174,7 @@ local function handle_groupchat(event)
"cancel",
-- error_condition = 'not-allowed' (see RFC 6120 Defined Error Conditions https://xmpp.org/rfcs/rfc6120.html#stanzas-error-conditions)
"bad-request",
"This choice is not valid."
string_poll_invalid_choice
));
return true; -- stop!
end
@ -205,7 +208,7 @@ local function handle_groupchat(event)
"continue",
-- error_condition
"undefined-condition",
"You vote is taken into account. Votes are anonymous, it will not be shown to other participants."
string_poll_anonymous_vote_ok
));
return true; -- stop!
end