diff --git a/frontend_tests/node_tests/unread.js b/frontend_tests/node_tests/unread.js index 9d5861343c..32e53ad895 100644 --- a/frontend_tests/node_tests/unread.js +++ b/frontend_tests/node_tests/unread.js @@ -3,10 +3,14 @@ zrequire('muting'); zrequire('people'); zrequire('stream_data'); zrequire('unread'); + +set_global('page_params', { + realm_push_notifications_enabled: false, +}); zrequire('settings_notifications'); + const FoldDict = zrequire('fold_dict').FoldDict; -set_global('page_params', {}); set_global('blueslip', {}); set_global('narrow_state', {}); set_global('current_msg_list', {}); diff --git a/static/js/settings.js b/static/js/settings.js index b3714db16b..ea846a7de5 100644 --- a/static/js/settings.js +++ b/static/js/settings.js @@ -114,8 +114,8 @@ exports.build_page = function () { twenty_four_hour_time_values: settings_config.twenty_four_hour_time_values, notification_settings: settings_notifications.all_notifications.settings, desktop_icon_count_display_values: settings_notifications.desktop_icon_count_display_values, - push_notification_tooltip: - settings_notifications.all_notifications.push_notification_tooltip, + show_push_notifications_tooltip: + settings_notifications.all_notifications.show_push_notifications_tooltip, display_settings: settings_config.get_all_display_settings(), user_can_change_name: settings_account.user_can_change_name(), user_can_change_avatar: settings_account.user_can_change_avatar(), diff --git a/static/js/settings_notifications.js b/static/js/settings_notifications.js index d9acd7a92b..a3ae4040be 100644 --- a/static/js/settings_notifications.js +++ b/static/js/settings_notifications.js @@ -54,10 +54,10 @@ exports.all_notifications = { mobile_notification_settings: mobile_notification_settings, email_notification_settings: email_notification_settings, }, - push_notification_tooltip: { - enable_stream_push_notifications: true, - enable_offline_push_notifications: true, - enable_online_push_notifications: true, + show_push_notifications_tooltip: { + enable_stream_push_notifications: !page_params.realm_push_notifications_enabled, + enable_offline_push_notifications: !page_params.realm_push_notifications_enabled, + enable_online_push_notifications: !page_params.realm_push_notifications_enabled, }, }; diff --git a/static/templates/settings/notification_settings.hbs b/static/templates/settings/notification_settings.hbs index 59937cec56..2d2bba86a7 100644 --- a/static/templates/settings/notification_settings.hbs +++ b/static/templates/settings/notification_settings.hbs @@ -12,8 +12,7 @@ setting_name=this is_checked=(lookup ../page_params this) label=(lookup ../settings_label this) - realm_push_notifications_enabled=(lookup ../page_params "realm_push_notifications_enabled") - push_notifications_tooltip=(lookup ../push_notification_tooltip this)}} + show_push_notifications_tooltip=(lookup ../show_push_notifications_tooltip this)}} {{/each}}

@@ -30,8 +29,7 @@ setting_name=this is_checked=(lookup ../page_params this) label=(lookup ../settings_label this) - realm_push_notifications_enabled=(lookup ../page_params "realm_push_notifications_enabled") - push_notifications_tooltip=(lookup ../push_notification_tooltip this)}} + show_push_notifications_tooltip=(lookup ../show_push_notifications_tooltip this)}} {{/each}} @@ -81,8 +79,7 @@ setting_name=this is_checked=(lookup ../page_params this) label=(lookup ../settings_label this) - realm_push_notifications_enabled=(lookup ../page_params "realm_push_notifications_enabled") - push_notifications_tooltip=(lookup ../push_notification_tooltip this)}} + show_push_notifications_tooltip=(lookup ../show_push_notifications_tooltip this)}} {{/each}}

{{t "Email" }}
diff --git a/static/templates/settings/settings_checkbox.hbs b/static/templates/settings/settings_checkbox.hbs index 8552385f00..b93c1f4d87 100644 --- a/static/templates/settings/settings_checkbox.hbs +++ b/static/templates/settings/settings_checkbox.hbs @@ -1,11 +1,11 @@ {{#unless (eq render_only false)}} -
+