From 08f35e08a4cdf56994e9344683303e34b31556a7 Mon Sep 17 00:00:00 2001 From: Sahil Batra Date: Tue, 18 Jun 2024 15:47:04 +0530 Subject: [PATCH] stream_settings: Update save discard buttons when live-updating. This commit adds code to hide save discard buttons and discard the changes if another user changed a setting in the same subsection. --- web/src/stream_ui_updates.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/web/src/stream_ui_updates.js b/web/src/stream_ui_updates.js index 65006e2314..c022040db6 100644 --- a/web/src/stream_ui_updates.js +++ b/web/src/stream_ui_updates.js @@ -399,7 +399,12 @@ export function update_setting_element(sub, setting_name) { } const $elem = $(`#id_${CSS.escape(setting_name)}`); - settings_org.discard_stream_property_element_changes($elem, sub); + const $subsection = $elem.closest(".settings-subsection-parent"); + if ($subsection.find(".save-button-controls").hasClass("hide")) { + settings_org.discard_stream_property_element_changes($elem); + } else { + settings_org.discard_stream_settings_subsection_changes($subsection, sub); + } } export function enable_or_disable_add_subscribers_elements(