Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
settings: Add `push_notifications_disabled` in notification checkboxes.
Saubhagya Patel45f38795e9f9
diff --git a/web/src/settings_config.ts b/web/src/settings_config.tsindex 04355217156..5f822ae0e11 100644--- a/web/src/settings_config.ts+++ b/web/src/settings_config.ts@@ -973,6 +973,7 @@ type NotificationSettingCheckbox = {is_disabled: boolean;is_checked: boolean;is_mobile_checkbox: boolean;+ push_notifications_disabled: boolean;};export function get_notifications_table_row_data(@@ -987,6 +988,7 @@ export function get_notifications_table_row_data(is_disabled: true,is_checked: false,is_mobile_checkbox: false,+ push_notifications_disabled: false,};}@@ -1000,6 +1002,7 @@ export function get_notifications_table_row_data(is_disabled: false,is_checked: checked,is_mobile_checkbox: false,+ push_notifications_disabled: !realm.realm_push_notifications_enabled,};if (column === "mobile") {checkbox.is_disabled = !realm.realm_push_notifications_enabled;diff --git a/web/src/settings_notifications.ts b/web/src/settings_notifications.tsindex 05ffca5c4c3..2704cf337fc 100644--- a/web/src/settings_notifications.ts+++ b/web/src/settings_notifications.ts@@ -75,6 +75,7 @@ function rerender_ui(): void {settings_config.all_notifications(user_settings).disabled_notification_settings,muted: muted_stream_ids.includes(stream.stream_id),+ push_notifications_disabled: !realm.realm_push_notifications_enabled,}),),);diff --git a/web/templates/settings/notification_settings.hbs b/web/templates/settings/notification_settings.hbsindex 2a713f23ea7..7ca5a982a1c 100644--- a/web/templates/settings/notification_settings.hbs+++ b/web/templates/settings/notification_settings.hbs@@ -41,6 +41,7 @@is_checked=this.is_checkedis_disabled=this.is_disabledis_mobile_checkbox=this.is_mobile_checkbox+ push_notifications_disabled=this.push_notifications_disabledprefix=../../prefix }}{{/each}}</tr>diff --git a/web/templates/settings/notification_settings_checkboxes.hbs b/web/templates/settings/notification_settings_checkboxes.hbsindex 664a82c6676..76409a9e370 100644--- a/web/templates/settings/notification_settings_checkboxes.hbs+++ b/web/templates/settings/notification_settings_checkboxes.hbs@@ -1,5 +1,5 @@<td>- <span {{#if (and is_mobile_checkbox is_disabled)}} class="tippy-zulip-tooltip" data-tooltip-template-id="mobile-push-notification-tooltip-template"{{/if}}>+ <span {{#if (and is_mobile_checkbox push_notifications_disabled)}} class="tippy-zulip-tooltip" data-tooltip-template-id="mobile-push-notification-tooltip-template"{{/if}}><label class="checkbox"><input type="checkbox" name="{{setting_name}}" id="{{prefix}}{{setting_name}}"{{#if is_disabled}} disabled {{/if}}diff --git a/web/templates/settings/stream_specific_notification_row.hbs b/web/templates/settings/stream_specific_notification_row.hbsindex f52468e142c..fbb47b79a94 100644--- a/web/templates/settings/stream_specific_notification_row.hbs+++ b/web/templates/settings/stream_specific_notification_row.hbs@@ -16,6 +16,7 @@is_checked=(lookup ../stream this)is_disabled=(lookup ../is_disabled this)is_mobile_checkbox=(eq this "push_notifications")+ push_notifications_disabled=../push_notifications_disabled}}{{/each}}</tr>diff --git a/web/tests/settings_config.test.cjs b/web/tests/settings_config.test.cjsindex d96762f1674..cc030006a7c 100644--- a/web/tests/settings_config.test.cjs+++ b/web/tests/settings_config.test.cjs@@ -9,7 +9,8 @@ const settings_config = zrequire("settings_config");const {set_realm} = zrequire("state_data");const {initialize_user_settings} = zrequire("user_settings");-set_realm({});+const realm = {realm_push_notifications_enabled: false};+set_realm(realm);const user_settings = {};initialize_user_settings({user_settings});@@ -55,30 +56,35 @@ run_test("all_notifications", ({override}) => {is_disabled: false,is_mobile_checkbox: false,setting_name: "enable_stream_desktop_notifications",+ push_notifications_disabled: true,},{is_checked: true,is_disabled: false,is_mobile_checkbox: false,setting_name: "enable_stream_audible_notifications",+ push_notifications_disabled: true,},{is_checked: true,is_disabled: true,is_mobile_checkbox: true,setting_name: "enable_stream_push_notifications",+ push_notifications_disabled: true,},{is_checked: false,is_disabled: false,is_mobile_checkbox: false,setting_name: "enable_stream_email_notifications",+ push_notifications_disabled: true,},{is_checked: false,is_disabled: false,is_mobile_checkbox: false,setting_name: "wildcard_mentions_notify",+ push_notifications_disabled: true,},],},@@ -90,30 +96,35 @@ run_test("all_notifications", ({override}) => {is_disabled: false,is_mobile_checkbox: false,setting_name: "enable_desktop_notifications",+ push_notifications_disabled: true,},{is_checked: true,is_disabled: false,is_mobile_checkbox: false,setting_name: "enable_sounds",+ push_notifications_disabled: true,},{is_checked: false,is_disabled: true,is_mobile_checkbox: true,setting_name: "enable_offline_push_notifications",+ push_notifications_disabled: true,},{is_checked: true,is_disabled: false,is_mobile_checkbox: false,setting_name: "enable_offline_email_notifications",+ push_notifications_disabled: true,},{is_checked: false,is_disabled: true,is_mobile_checkbox: false,setting_name: "",+ push_notifications_disabled: false,},],},@@ -126,30 +137,35 @@ run_test("all_notifications", ({override}) => {is_disabled: false,is_mobile_checkbox: false,setting_name: "enable_followed_topic_desktop_notifications",+ push_notifications_disabled: true,},{is_checked: true,is_disabled: false,is_mobile_checkbox: false,setting_name: "enable_followed_topic_audible_notifications",+ push_notifications_disabled: true,},{is_checked: false,is_disabled: true,is_mobile_checkbox: true,setting_name: "enable_followed_topic_push_notifications",+ push_notifications_disabled: true,},{is_checked: true,is_disabled: false,is_mobile_checkbox: false,setting_name: "enable_followed_topic_email_notifications",+ push_notifications_disabled: true,},{is_checked: false,is_disabled: false,is_mobile_checkbox: false,setting_name: "enable_followed_topic_wildcard_mentions_notify",+ push_notifications_disabled: true,},],},