settings: Pass user settings using settings_object variable.

Instead of passing user settings directly as user_settings
variable to the settings templates, we pass them using
settings_object variable.

This change is important so that we can use the exisiting
display_settings and notification_settings template for
realm-level default settings by passing realm-level
settings using settings_source variable.
This commit is contained in:
Sahil Batra 2021-08-25 16:33:05 +05:30 committed by Tim Abbott
parent afeb4b2113
commit 40f4316972
5 changed files with 10 additions and 10 deletions

View File

@ -126,7 +126,7 @@ export function build_page() {
user_role_text: people.get_user_type(page_params.user_id),
default_language_name: settings_display.default_language_name,
language_list_dbl_col: get_language_list_columns(user_settings.default_language),
user_settings,
settings_object: user_settings,
});
$(".settings-box").html(rendered_settings_tab);

View File

@ -101,7 +101,7 @@
<div class="input-group">
{{> settings_checkbox
setting_name="presence_enabled"
is_checked=user_settings.presence_enabled
is_checked=settings_object.presence_enabled
label=settings_label.presence_enabled
help_link="/help/status-and-availability"
prefix="user_"}}

View File

@ -42,7 +42,7 @@
{{#each display_settings.settings.user_display_settings}}
{{> settings_checkbox
setting_name=this
is_checked=(lookup ../user_settings this)
is_checked=(lookup ../settings_object this)
label=(lookup ../settings_label this)
render_only=(lookup ../display_settings.render_only this)
prefix=../prefix}}
@ -80,7 +80,7 @@
<div class="input-group">
<div class="emojiset_choices grey-box">
{{#each user_settings.emojiset_choices}}
{{#each settings_object.emojiset_choices}}
<label>
<input type="radio" class="setting_emojiset_choice" name="emojiset_group" value="{{this.key}}" />
<span>{{this.text}}</span>
@ -101,7 +101,7 @@
{{> settings_checkbox
setting_name="translate_emoticons"
is_checked=user_settings.translate_emoticons
is_checked=settings_object.translate_emoticons
label=settings_label.translate_emoticons
prefix=prefix}}
</div>

View File

@ -56,7 +56,7 @@
{{#each notification_settings.desktop_notification_settings}}
{{> settings_checkbox
setting_name=this
is_checked=(lookup ../user_settings this)
is_checked=(lookup ../settings_object this)
label=(lookup ../settings_label this)
prefix=../prefix}}
{{/each}}
@ -71,7 +71,7 @@
disabled
{{/unless}}>
<option value="none">{{t "None" }}</option>
{{#each user_settings.available_notification_sounds}}
{{#each settings_object.available_notification_sounds}}
<option value="{{ this }}">{{ this }}</option>
{{/each}}
</select>
@ -97,7 +97,7 @@
{{#each notification_settings.mobile_notification_settings}}
{{> settings_checkbox
setting_name=this
is_checked=(lookup ../user_settings this)
is_checked=(lookup ../settings_object this)
label=(lookup ../settings_label this)
show_push_notifications_tooltip=(lookup ../show_push_notifications_tooltip this)
prefix=../prefix}}
@ -124,7 +124,7 @@
{{#each notification_settings.email_message_notification_settings}}
{{> settings_checkbox
setting_name=this
is_checked=(lookup ../user_settings this)
is_checked=(lookup ../settings_object this)
label=(lookup ../settings_label this)
prefix=../prefix}}
{{/each}}

View File

@ -33,7 +33,7 @@
<div class="alert-notification timezone-setting-status"></div>
<div class="timezone-input">
<select name="timezone" id="user_timezone" class>
{{#unless user_settings.timezone}}
{{#unless settings_object.timezone}}
<option></option>
{{/unless}}