Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
settings: Use discard function to live-update realm default settings.
Sahil Batrada95d01c3740
diff --git a/web/src/settings_realm_user_settings_defaults.js b/web/src/settings_realm_user_settings_defaults.jsindex 8607d277210..b6df9f271ea 100644--- a/web/src/settings_realm_user_settings_defaults.js+++ b/web/src/settings_realm_user_settings_defaults.js@@ -3,7 +3,6 @@ import $ from "jquery";import * as audible_notifications from "./audible_notifications";import * as overlays from "./overlays";import {realm_user_settings_defaults} from "./realm_user_settings_defaults";-import * as settings_components from "./settings_components";import * as settings_notifications from "./settings_notifications";import * as settings_org from "./settings_org";import * as settings_preferences from "./settings_preferences";@@ -32,30 +31,11 @@ export function update_page(property) {if (!overlays.settings_open()) {return;}- const $container = $(realm_default_settings_panel.container);- let value = realm_user_settings_defaults[property];-- // settings_org.set_input_element_value doesn't support radio- // button widgets like these.- if (property === "emojiset" || property === "user_list_style") {- $container.find(`input[value=${CSS.escape(value)}]`).prop("checked", true);- return;- }- if (property === "email_notifications_batching_period_seconds") {- settings_notifications.set_notification_batching_ui($container, value);- return;- }-- // The twenty_four_hour_time setting is represented as a boolean- // in the API, but a dropdown with "true"/"false" as strings in- // the UI, so we need to convert its format here.- if (property === "twenty_four_hour_time") {- value = value.toString();+ const $element = $(`#realm_${CSS.escape(property)}`);+ if ($element.length) {+ settings_org.discard_realm_default_property_element_changes($element[0]);}-- const $input_elem = $container.find(`[name=${CSS.escape(property)}]`);- settings_components.set_input_element_value($input_elem, value);}export function set_up() {