mirror of
				https://github.com/zulip/zulip.git
				synced 2025-11-03 21:43:21 +00:00 
			
		
		
		
	settings: Add UI for automatically follow and unmute topics settings.
This commit adds two drop-down settings in 'SETTINGS / NOTIFICATIONS' and 'SETTINGS / DEFAULT USER SETTINGS'. The new settings lie in a new section named "Topic notifications", just below the "Noification triggers" section. Label: "Automatically follow topics" Options: "Topics I participate in", "Topics I send a message to", "Topics I start", and "Never". Label: "Automatically unmute topics in muted streams" Options: "Topics I participate in", "Topics I send a message to", "Topics I start", and "Never". Fixes #25914.
This commit is contained in:
		
				
					committed by
					
						
						Tim Abbott
					
				
			
			
				
	
			
			
			
						parent
						
							58568a60d6
						
					
				
				
					commit
					28fb5ea24d
				
			@@ -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 words
 | 
			
		||||
    r"beta",
 | 
			
		||||
    r"and",
 | 
			
		||||
 
 | 
			
		||||
@@ -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") {
 | 
			
		||||
 
 | 
			
		||||
@@ -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;
 | 
			
		||||
 
 | 
			
		||||
@@ -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);
 | 
			
		||||
 
 | 
			
		||||
@@ -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"}),
 | 
			
		||||
    },
 | 
			
		||||
};
 | 
			
		||||
 
 | 
			
		||||
@@ -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;
 | 
			
		||||
            }
 | 
			
		||||
 
 | 
			
		||||
@@ -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;
 | 
			
		||||
 
 | 
			
		||||
@@ -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">
 | 
			
		||||
 
 | 
			
		||||
@@ -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",
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user