Only allow moderator to create polls

The Polls feature recently landed in the master branch and it’s awesome. As of now, Both moderator and non-moderator can create a poll but it would be great if it’s possible to restrict this functionality to moderator only.

Few snippets of poll feature

  1. create Polls screen

  2. *Add mulitple options

  3. can select multiple options at the same time

  4. Result after submit

1 Like

And it would be nice if it’s allowed using a JWT flag too

4 Likes

Exactly, this is what I’m looking forward to.

for some reason, it’s not working for me (prosody don’t start saying that muc should be loaded as component). I had to do:

--- mod_polls.lua.old	2021-08-17 10:07:08.603800613 +0200
+++ mod_polls.lua	2021-08-17 09:35:19.492103033 +0200
@@ -6,7 +6,7 @@
 local st = require("util.stanza");
 
 local util = module:require("util");
-local muc = module:depends("muc");
+local get_room_from_jid = module:require "util".get_room_from_jid;
 
 local is_healthcheck_room = util.is_healthcheck_room;
 
@@ -57,7 +57,7 @@
 	local data = get_poll_message(event.stanza);
 	if data == nil then return end
 
-	local room = muc.get_room_from_jid(event.stanza.attr.to);
+	local room = get_room_from_jid(event.stanza.attr.to);
 
 	if data.type == "new-poll" then
 		if check_polls(room) then return end

This is with unstable and Ubuntu 20.04 LTS with its original Prosody version. Maybe it’s coming from me having installed the thing quite some time ago and not doing all necessary config updates.
Another possibility for update trouble is not having the prosody module loaded, the UI is available but polls are not - quite logically - seen from an user to another.

And well, about your question it does not seem possible yet and sites where users are unruly should disable the feature in the UI. Rome was not built in a day and so on.

Also, as of now we can select multiple options. Can we restrict it to one?

Agree, unless there is an on-boarding for moderators where the nature of the poll is defined.

Pick how the poll will work;
A. One selection or answer
B. Multiple choice

This would then allow for better management of output as most questions need only one answer or decision.