Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
settings: Add UI for automatically follow and unmute topics settings.
Prakhar Pratyush28fb5ea24db2
diff --git a/tools/lib/capitalization.py b/tools/lib/capitalization.pyindex 13a24f22f16..02c064b5e8b 100644--- a/tools/lib/capitalization.py+++ b/tools/lib/capitalization.py@@ -58,6 +58,9 @@ IGNORED_PHRASES = [r"I understand",r"I'm",r"I've",+ r"Topics I participate in",+ r"Topics I send a message to",+ r"Topics I start",# Specific short wordsr"beta",r"and",diff --git a/web/src/admin.js b/web/src/admin.jsindex 786119ac6d2..ee1e75ced71 100644--- a/web/src/admin.js+++ b/web/src/admin.js@@ -209,6 +209,10 @@ export function build_page() {settings_users.allow_sorting_deactivated_users_list_by_email(),has_bots: bot_data.get_all_bots_for_current_user().length > 0,user_has_email_set: !settings_data.user_email_not_configured(),+ automatically_follow_topics_policy_values:+ settings_config.automatically_follow_or_unmute_topics_policy_values,+ automatically_unmute_topics_in_muted_streams_policy_values:+ settings_config.automatically_follow_or_unmute_topics_policy_values,};if (options.realm_logo_source !== "D" && options.realm_night_logo_source === "D") {diff --git a/web/src/realm_user_settings_defaults.ts b/web/src/realm_user_settings_defaults.tsindex fc7e53b2f41..55e1770c49b 100644--- a/web/src/realm_user_settings_defaults.ts+++ b/web/src/realm_user_settings_defaults.ts@@ -42,6 +42,8 @@ export type RealmDefaultSettings = {web_stream_unreads_count_display_policy: number;web_mark_read_on_scroll_policy: number;wildcard_mentions_notify: boolean;+ automatically_follow_topics_policy: number;+ automatically_unmute_topics_in_muted_streams_policy: number;};export let realm_user_settings_defaults: RealmDefaultSettings;diff --git a/web/src/settings.js b/web/src/settings.jsindex 7a89121ed6c..114e17fc487 100644--- a/web/src/settings.js+++ b/web/src/settings.js@@ -130,6 +130,10 @@ export function build_page() {owner_is_only_user_in_organization: people.get_active_human_count() === 1,user_can_change_password: user_can_change_password(),user_has_email_set: !settings_data.user_email_not_configured(),+ automatically_follow_topics_policy_values:+ settings_config.automatically_follow_or_unmute_topics_policy_values,+ automatically_unmute_topics_in_muted_streams_policy_values:+ settings_config.automatically_follow_or_unmute_topics_policy_values,});settings_bots.update_bot_settings_tip($("#personal-bot-settings-tip"), false);diff --git a/web/src/settings_config.ts b/web/src/settings_config.tsindex df5f42f329d..926b5955f6c 100644--- a/web/src/settings_config.ts+++ b/web/src/settings_config.ts@@ -579,6 +579,12 @@ export const notification_settings_labels = {realm_name_in_email_notifications_policy: $t({defaultMessage: "Include organization name in subject of message notification emails",}),+ automatically_follow_topics_policy: $t({+ defaultMessage: "Automatically follow topics",+ }),+ automatically_unmute_topics_in_muted_streams_policy: $t({+ defaultMessage: "Automatically unmute topics in muted streams",+ }),};export const realm_user_settings_defaults_labels = {@@ -741,6 +747,8 @@ const other_notification_settings = ["email_notifications_batching_period_seconds","realm_name_in_email_notifications_policy","notification_sound",+ "automatically_follow_topics_policy",+ "automatically_unmute_topics_in_muted_streams_policy",];export const all_notification_settings = [@@ -922,3 +930,22 @@ export const user_topic_visibility_policy_values = {description: $t({defaultMessage: "Default for stream"}),},};++export const automatically_follow_or_unmute_topics_policy_values = {+ participation: {+ code: 1,+ description: $t({defaultMessage: "Topics I participate in"}),+ },+ send: {+ code: 2,+ description: $t({defaultMessage: "Topics I send a message to"}),+ },+ initiation: {+ code: 3,+ description: $t({defaultMessage: "Topics I start"}),+ },+ never: {+ code: 4,+ description: $t({defaultMessage: "Never"}),+ },+};diff --git a/web/src/settings_notifications.js b/web/src/settings_notifications.jsindex 45dea758334..09497a8e7c0 100644--- a/web/src/settings_notifications.js+++ b/web/src/settings_notifications.js@@ -159,6 +159,20 @@ export function set_up(settings_panel) {settings_object.realm_name_in_email_notifications_policy,);+ const $automatically_follow_topics_policy_dropdown = $container.find(+ ".setting_automatically_follow_topics_policy",+ );+ $automatically_follow_topics_policy_dropdown.val(+ settings_object.automatically_follow_topics_policy,+ );++ const $automatically_unmute_topics_in_muted_streams_policy_dropdown = $container.find(+ ".setting_automatically_unmute_topics_in_muted_streams_policy",+ );+ $automatically_unmute_topics_in_muted_streams_policy_dropdown.val(+ settings_object.automatically_unmute_topics_in_muted_streams_policy,+ );+set_enable_digest_emails_visibility(settings_panel);if (for_realm_settings) {@@ -276,7 +290,9 @@ export function update_page(settings_panel) {break;}case "notification_sound":- case "realm_name_in_email_notifications_policy": {+ case "realm_name_in_email_notifications_policy":+ case "automatically_follow_topics_policy":+ case "automatically_unmute_topics_in_muted_streams_policy": {$container.find(`.setting_${CSS.escape(setting)}`).val(settings_object[setting]);break;}diff --git a/web/src/user_settings.ts b/web/src/user_settings.tsindex be3a9c29d85..fda6b06ed24 100644--- a/web/src/user_settings.ts+++ b/web/src/user_settings.ts@@ -56,6 +56,8 @@ export type UserSettings = (StreamNotificationSettings &send_stream_typing_notifications: boolean;send_private_typing_notifications: boolean;send_read_receipts: boolean;+ automatically_follow_topics_policy: number;+ automatically_unmute_topics_in_muted_streams_policy: number;};export let user_settings: UserSettings;diff --git a/web/templates/settings/notification_settings.hbs b/web/templates/settings/notification_settings.hbsindex 360258c78a8..6d36bfa966a 100644--- a/web/templates/settings/notification_settings.hbs+++ b/web/templates/settings/notification_settings.hbs@@ -49,6 +49,35 @@</table></div>+ {{#if development}}+ <div class="topic_notifications m-10 {{#if for_realm_settings}}settings-subsection-parent{{else}}subsection-parent{{/if}}">++ <div class="subsection-header inline-block">+ <h3>{{t "Topic notifications" }}+ {{> ../help_link_widget link="/help/mute-a-topic" }}+ </h3>+ {{> settings_save_discard_widget section_name="topic-notifications-settings" show_only_indicator=(not for_realm_settings) }}+ <p>{{t "You will automatically follow topics that you have configured to both follow and unmute." }}</p>+ </div>++ <div class="input-group">+ <label for="automatically_follow_topics_policy" class="dropdown-title">{{ settings_label.automatically_follow_topics_policy }}</label>+ <select name="automatically_follow_topics_policy" class="setting_automatically_follow_topics_policy prop-element settings_select bootstrap-focus-style"+ id="{{prefix}}automatically_follow_topics_policy" data-setting-widget-type="number">+ {{> dropdown_options_widget option_values=automatically_follow_topics_policy_values}}+ </select>+ </div>++ <div class="input-group">+ <label for="automatically_unmute_topics_in_muted_streams_policy" class="dropdown-title">{{ settings_label.automatically_unmute_topics_in_muted_streams_policy }}</label>+ <select name="automatically_unmute_topics_in_muted_streams_policy" class="setting_automatically_unmute_topics_in_muted_streams_policy prop-element settings_select bootstrap-focus-style"+ id="{{prefix}}automatically_unmute_topics_in_muted_streams_policy" data-setting-widget-type="number">+ {{> dropdown_options_widget option_values=automatically_unmute_topics_in_muted_streams_policy_values}}+ </select>+ </div>+ </div>+ {{/if}}+<div class="desktop_notifications m-10 {{#if for_realm_settings}}settings-subsection-parent{{else}}subsection-parent{{/if}}"><div class="subsection-header inline-block">diff --git a/web/tests/i18n.test.js b/web/tests/i18n.test.jsindex 773df89173f..20d1387791d 100644--- a/web/tests/i18n.test.js+++ b/web/tests/i18n.test.js@@ -104,6 +104,9 @@ run_test("tr_tag", ({mock_template}) => {realm_name_in_email_notifications_policy:"Include organization name in subject of message notification emails",twenty_four_hour_time: "Time format",+ automatically_follow_topics_policy: "Automatically follow topics",+ automatically_unmute_topics_in_muted_streams_policy:+ "Automatically unmute topics in muted streams",},show_push_notifications_tooltip: false,user_role_text: "Member",