Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

settings_org: Add frontend to change wildcard_mention_policy.

sahil8391d5aa2e5144b
diff --git a/static/js/admin.js b/static/js/admin.js
index 0c8508ba674..4a8c7b30274 100644
--- a/static/js/admin.js
+++ b/static/js/admin.js
@@ -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,
diff --git a/static/js/server_events_dispatch.js b/static/js/server_events_dispatch.js
index ff32476212d..347838cb210 100644
--- a/static/js/server_events_dispatch.js
+++ b/static/js/server_events_dispatch.js
@@ -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" &&
diff --git a/static/js/settings_config.js b/static/js/settings_config.js
index 9f01bc9a680..d08d1b77831 100644
--- a/static/js/settings_config.js
+++ b/static/js/settings_config.js
@@ -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",
diff --git a/static/js/settings_org.js b/static/js/settings_org.js
index bb515a33952..79f33df6461 100644
--- a/static/js/settings_org.js
+++ b/static/js/settings_org.js
@@ -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) {
diff --git a/static/styles/settings.css b/static/styles/settings.css
index 9bfef5e41f2..f91d2e2aa41 100644
--- a/static/styles/settings.css
+++ b/static/styles/settings.css
@@ -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%;
}
diff --git a/static/templates/settings/organization_permissions_admin.hbs b/static/templates/settings/organization_permissions_admin.hbs
index b686be83750..17f560f8f20 100644
--- a/static/templates/settings/organization_permissions_admin.hbs
+++ b/static/templates/settings/organization_permissions_admin.hbs
@@ -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>
diff --git a/templates/zerver/help/mention-a-user-or-group.md b/templates/zerver/help/mention-a-user-or-group.md
index f3771585c7f..752df26d564 100644
--- a/templates/zerver/help/mention-a-user-or-group.md
+++ b/templates/zerver/help/mention-a-user-or-group.md
@@ -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}
diff --git a/templates/zerver/help/moderating-open-organizations.md b/templates/zerver/help/moderating-open-organizations.md
index 56fe79a8d27..36101bc794e 100644
--- a/templates/zerver/help/moderating-open-organizations.md
+++ b/templates/zerver/help/moderating-open-organizations.md
@@ -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