settings_org: Add frontend to change wildcard_mention_policy.

We add dropdown for wildcard_mention_policy in organization
permissions page.
This commit is contained in:
sahil839 2020-09-14 22:56:42 +05:30 committed by Tim Abbott
parent d0f5537fb2
commit 1d5aa2e514
8 changed files with 87 additions and 4 deletions

View File

@ -59,6 +59,7 @@ exports.build_page = function () {
realm_user_group_edit_policy: page_params.realm_user_group_edit_policy,
USER_GROUP_EDIT_POLICY_MEMBERS: 1,
realm_private_message_policy: page_params.realm_private_message_policy,
realm_wildcard_mention_policy: page_params.realm_wildcard_mention_policy,
realm_name_changes_disabled: page_params.realm_name_changes_disabled,
realm_email_changes_disabled: page_params.realm_email_changes_disabled,
realm_avatar_changes_disabled: page_params.realm_avatar_changes_disabled,

View File

@ -143,6 +143,7 @@ exports.dispatch_normal_event = function dispatch_normal_event(event) {
emails_restricted_to_domains: noop,
video_chat_provider: compose.update_video_chat_button_display,
waiting_period_threshold: noop,
wildcard_mention_policy: noop,
};
if (
event.op === "update" &&

View File

@ -137,6 +137,43 @@ exports.private_message_policy_values = {
},
};
exports.wildcard_mention_policy_values = {
by_everyone: {
order: 1,
code: 1,
description: i18n.t("Admins, members and guests"),
},
by_members: {
order: 2,
code: 2,
description: i18n.t("Admins and members"),
},
by_full_members: {
order: 3,
code: 3,
description: i18n.t("Admins and full members"),
},
// Until we add stream administrators, we mislabel this choice
// (which we intend to be the long-term default) as "Admins only"
// and don't offer the long-term "Admins only" option.
by_stream_admins_only: {
order: 4,
code: 4,
// description: i18n.t("Organization and stream admins"),
description: i18n.t("Admins only"),
},
// by_admins_only: {
// order: 5,
// code: 5,
// description: i18n.t("Admins only"),
// },
nobody: {
order: 6,
code: 6,
description: i18n.t("Nobody"),
},
};
const time_limit_dropdown_values = new Map([
[
"any_time",

View File

@ -87,6 +87,9 @@ exports.get_organization_settings_options = () => {
options.private_message_policy_values = exports.get_sorted_options_list(
settings_config.private_message_policy_values,
);
options.wildcard_mention_policy_values = exports.get_sorted_options_list(
settings_config.wildcard_mention_policy_values,
);
return options;
};
@ -203,6 +206,7 @@ const simple_dropdown_properties = [
"realm_private_message_policy",
"realm_add_emoji_by_admins_only",
"realm_user_invite_restriction",
"realm_wildcard_mention_policy",
];
function set_property_dropdown_value(property_name) {

View File

@ -1543,7 +1543,8 @@ body:not(.night-mode) #settings_page .custom_user_field .datepicker {
#id_realm_invite_to_stream_policy,
#id_realm_org_join_restrictions,
#id_realm_bot_creation_policy,
#id_realm_user_invite_restriction {
#id_realm_user_invite_restriction,
#id_realm_wildcard_mention_policy {
width: 100%;
}

View File

@ -150,6 +150,13 @@
{{> dropdown_options_widget option_values=private_message_policy_values}}
</select>
</div>
<div class="input-group">
<label for="realm_wildcard_mention_policy" class="dropdown-title">{{t "Who can use wildcard mentions in large streams" }}</label>
<select name="realm_wildcard_mention_policy" id="id_realm_wildcard_mention_policy" class="prop-element" data-setting-widget-type="number">
{{> dropdown_options_widget option_values=wildcard_mention_policy_values}}
</select>
</div>
</div>
</div>
</form>

View File

@ -49,8 +49,38 @@ notification. Silent mentions start with `@_` instead of `@`.
## Mention everyone on a stream
You can mention everyone on a stream with the `@**all**` mention. Use
sparingly! Note that this will not notify anyone who has muted the
stream, and users can disable receiving email/push notifications for
these wildcard mentions, either
sparingly! Used improperly, wildcard mentions can be annoying.
Note that this will not notify anyone who has muted the stream, and
users can disable receiving email/push notifications for these
wildcard mentions, either
[globally](/help/pm-mention-alert-notifications) or for [individual
streams](/help/stream-notifications).
### Restrictions on wildcard mentions
Organization administrators can set a policy for which users are
allowed to use wildcard mentions.
Zulip allows anyone to use wildcard mentions in streams with at most
15 subscribers.
Organizations administrators can configure a policy for which classes
of users are allowed to use wildcard mentions in streams with more
than 15 subscribers. The default allows only organization
administrators to use wildcard mentions in large streams.
Users permitted to use wildcard mentions by the organization's policy
are warned that wildcard mentions result in everyone receiving email
and mobile push notifications.
{start_tabs}
{settings_tab|organization-permissions}
2. Under **Organization permissions**, configure
**Who can use wildcard mentions in large streams**.
{!save-changes.md!}
{end_tabs}

View File

@ -24,6 +24,8 @@ Zulip has many features designed to simplify moderation:
new users can take disruptive actions.
* [Restrict email visibility](/help/restrict-visibility-of-email-addresses)
to reduce the likelihood of off-platform spam.
* [Restrict wildcard mentions](/help/mention-a-user-or-group#restrictions-on-wildcard-mentions)
so only moderators can mention everyone in your organization.
## Response