diff --git a/frontend_tests/node_tests/templates.js b/frontend_tests/node_tests/templates.js index 134c219454..1e99f02763 100644 --- a/frontend_tests/node_tests/templates.js +++ b/frontend_tests/node_tests/templates.js @@ -1075,6 +1075,7 @@ run_test('settings_tab', () => { enable_offline_push_notifications: true, enable_online_push_notifications: true, enable_digest_emails: true, realm_name_in_notifications: true, + realm_push_notifications_enabled: true, }; var page_params = $.extend(page_param_checkbox_options, { full_name: "Alyssa P. Hacker", password_auth_enabled: true, diff --git a/static/js/templates.js b/static/js/templates.js index 850040b44e..1633039e09 100644 --- a/static/js/templates.js +++ b/static/js/templates.js @@ -62,6 +62,27 @@ Handlebars.registerHelper('if_and', function () { return options.fn(this); }); +Handlebars.registerHelper('unless_a_not_b', function () { + // Execute the conditional code if at least one condition is false. + // Example usage: + // {{#unless_a_not_b cond1 cond2}} + //
a is false or b is true
+ // {{/unless_a_not_b}} + var options = arguments[arguments.length - 1]; + if (arguments[0] && !arguments[1]) { + return options.inverse(this); + } + return options.fn(this); +}); + +Handlebars.registerHelper('if_not_a_or_b_and_not_c', function () { + var options = arguments[arguments.length - 1]; + if (arguments[0] === false || arguments[1] === true && arguments[2] === false) { + return options.fn(this); + } + return options.inverse(this); +}); + Handlebars.registerHelper('if_or', function () { // Execute the conditional code if any of the conditions are true. // Example usage: diff --git a/static/templates/settings/notification-settings.handlebars b/static/templates/settings/notification-settings.handlebars index 6cf7659e72..61d9a1a38f 100644 --- a/static/templates/settings/notification-settings.handlebars +++ b/static/templates/settings/notification-settings.handlebars @@ -24,6 +24,7 @@ "setting_name" "enable_stream_push_notifications" "is_checked" page_params.enable_stream_push_notifications "label" settings_label.enable_stream_push_notifications + "push_notifications_tooltip" true "end_content" ''}} {{partial "settings_checkbox" @@ -67,14 +68,16 @@ {{partial "settings_checkbox" "setting_name" "enable_offline_push_notifications" "is_checked" page_params.enable_offline_push_notifications - "label" settings_label.enable_offline_push_notifications}} + "label" settings_label.enable_offline_push_notifications + "push_notifications_tooltip" true}} {{partial "settings_checkbox" "setting_name" "enable_online_push_notifications" "is_checked" page_params.enable_online_push_notifications "is_parent_setting_enabled" page_params.enable_offline_push_notifications "is_nested" true - "label" settings_label.enable_online_push_notifications}} + "label" settings_label.enable_online_push_notifications + "push_notifications_tooltip" true}}