settings: Fix handling of day logo without night logo.

In this case, we should just use the day logo for both themes.
This commit is contained in:
Tim Abbott 2019-02-20 17:55:48 -08:00
parent 12756b48a0
commit 4df8a2ac0f
2 changed files with 20 additions and 1 deletions

View File

@ -68,6 +68,13 @@ exports.build_page = function () {
options.msg_delete_limit_dropdown_values = settings_org.msg_delete_limit_dropdown_values; options.msg_delete_limit_dropdown_values = settings_org.msg_delete_limit_dropdown_values;
options.bot_creation_policy_values = settings_bots.bot_creation_policy_values; options.bot_creation_policy_values = settings_bots.bot_creation_policy_values;
options.email_address_visibility_values = settings_org.email_address_visibility_values; options.email_address_visibility_values = settings_org.email_address_visibility_values;
if (options.realm_logo_source !== 'D' && options.realm_night_logo_source === 'D') {
// If no night mode logo is specified but a day mode one is,
// use the day mode one. See also similar code in realm_logo.js.
options.realm_night_logo_url = options.realm_logo_url;
}
var rendered_admin_tab = templates.render('admin_tab', options); var rendered_admin_tab = templates.render('admin_tab', options);
$("#settings_content .organization-box").html(rendered_admin_tab); $("#settings_content .organization-box").html(rendered_admin_tab);
$("#settings_content .alert").removeClass("show"); $("#settings_content .alert").removeClass("show");

View File

@ -62,7 +62,19 @@ var realm_logo = (function () {
var file_input = $("#realm_logo_file_input"); var file_input = $("#realm_logo_file_input");
var night_file_input = $("#realm_night_logo_file_input"); var night_file_input = $("#realm_night_logo_file_input");
$("#realm-settings-logo").attr("src", page_params.realm_logo_url); $("#realm-settings-logo").attr("src", page_params.realm_logo_url);
$("#realm-settings-night-logo").attr("src", page_params.realm_night_logo_url);
if (page_params.realm_night_logo_source === 'D' &&
page_params.realm_logo_source !== 'D') {
// If no night mode logo is uploaded but a day mode one
// is, use the day mode one; this handles the common case
// of transparent background logos that look good on both
// night and day themes. See also similar code in admin.js.
$("#realm-settings-night-logo").attr("src", page_params.realm_logo_url);
} else {
$("#realm-settings-night-logo").attr("src", page_params.realm_night_logo_url);
}
if (page_params.night_mode) { if (page_params.night_mode) {
$("#realm-logo").attr("src", page_params.realm_night_logo_url); $("#realm-logo").attr("src", page_params.realm_night_logo_url);
} else { } else {