mirror of
https://github.com/discourse/discourse.git
synced 2025-05-23 19:54:14 +08:00
FEATURE: introduces minimum trust level for polls (#5391)
* FEATURE: introduces minimum trust level for polls This commit makes `poll_enabled` less misleading and introduces `poll_minimum_trust_level_to_create`. If poll are enabled they will always be cooked, and if you have the required trust level you can create polls. As a side effect, it also fixes a bug where rebaking a post created by staff member when `poll_enabled=false` would end up not cooking it. It also adds more tests to ensure settings are respected. * admins should be whitelisted * checks for admin in post validation * test for >= instead of == trust level
This commit is contained in:

committed by
Régis Hanol

parent
f466791a15
commit
63bab32816
@ -281,10 +281,7 @@ const rule = {
|
||||
|
||||
function newApiInit(helper) {
|
||||
helper.registerOptions((opts, siteSettings) => {
|
||||
const currentUser = (opts.getCurrentUser && opts.getCurrentUser(opts.userId)) || opts.currentUser;
|
||||
const staff = currentUser && currentUser.staff;
|
||||
|
||||
opts.features.poll = !!siteSettings.poll_enabled || staff;
|
||||
opts.features.poll = !!siteSettings.poll_enabled;
|
||||
opts.pollMaximumOptions = siteSettings.poll_maximum_options;
|
||||
});
|
||||
|
||||
|
Reference in New Issue
Block a user