settings: Fix push notifications tooltip being incorrectly shown.

We were showing the push notifications tooltip in user default
settings section even if the push notifications were configured
on the server.

The bug was because the setting value was undefined in the template
used for user default settings section, so this commit fixes the bug
by correctly passing the setting value to relevant template file.

Fixes #21602.
This commit is contained in:
Sahil Batra
2022-03-30 15:09:21 +05:30
committed by Tim Abbott
parent 0008a76703
commit ca38b33346
3 changed files with 3 additions and 1 deletions

View File

@@ -161,6 +161,7 @@ export function build_page() {
settings_config.create_web_public_stream_policy_values, settings_config.create_web_public_stream_policy_values,
disable_enable_spectator_access_setting: !page_params.server_web_public_streams_enabled, disable_enable_spectator_access_setting: !page_params.server_web_public_streams_enabled,
can_sort_by_email: settings_data.show_email(), can_sort_by_email: settings_data.show_email(),
realm_push_notifications_enabled: page_params.realm_push_notifications_enabled,
}; };
if (options.realm_logo_source !== "D" && options.realm_night_logo_source === "D") { if (options.realm_logo_source !== "D" && options.realm_night_logo_source === "D") {

View File

@@ -98,6 +98,7 @@ export function build_page() {
user_can_change_avatar: settings_data.user_can_change_avatar(), user_can_change_avatar: settings_data.user_can_change_avatar(),
user_role_text: people.get_user_type(page_params.user_id), user_role_text: people.get_user_type(page_params.user_id),
default_language_name: settings_display.user_default_language_name, default_language_name: settings_display.user_default_language_name,
realm_push_notifications_enabled: page_params.realm_push_notifications_enabled,
settings_object: user_settings, settings_object: user_settings,
}); });

View File

@@ -12,7 +12,7 @@
<th colspan="2" width="28%">{{t "Desktop"}}</th> <th colspan="2" width="28%">{{t "Desktop"}}</th>
<th rowspan="2" width="14%" class="{{#if show_push_notifications_tooltip.push_notifications}}control-label-disabled{{/if}}"> <th rowspan="2" width="14%" class="{{#if show_push_notifications_tooltip.push_notifications}}control-label-disabled{{/if}}">
{{t "Mobile"}} {{t "Mobile"}}
{{#if (not page_params.realm_push_notifications_enabled) }} {{#if (not realm_push_notifications_enabled) }}
<i class="fa fa-question-circle settings-info-icon tippy-zulip-tooltip" data-tippy-content="{{t 'Mobile push notifications are not configured on this server.' }}"></i> <i class="fa fa-question-circle settings-info-icon tippy-zulip-tooltip" data-tippy-content="{{t 'Mobile push notifications are not configured on this server.' }}"></i>
{{/if}} {{/if}}
</th> </th>