mirror of
https://github.com/zulip/zulip.git
synced 2025-11-06 15:03:34 +00:00
stream_settings: Remove duplication logic.
This commit addresses code duplication issue in 'stream_is_muted_changed()' which was redundantly present in 'stream_setting_changed()'. The changes ensure that the functionality is now centralized and can be easily updated or extended in the future.
This commit is contained in:
committed by
Tim Abbott
parent
b275e9c4d6
commit
4903870ec3
@@ -308,25 +308,7 @@ function stream_notification_reset(e) {
|
||||
);
|
||||
}
|
||||
|
||||
function stream_is_muted_changed(e) {
|
||||
const sub = get_sub_for_target(e.target);
|
||||
if (!sub) {
|
||||
blueslip.error("stream_is_muted_changed() fails");
|
||||
return;
|
||||
}
|
||||
|
||||
stream_settings_api.set_stream_property(
|
||||
sub,
|
||||
{property: "is_muted", value: e.target.checked},
|
||||
$(`#stream_change_property_status${CSS.escape(sub.stream_id)}`),
|
||||
);
|
||||
}
|
||||
|
||||
function stream_setting_changed(e) {
|
||||
if (e.target.name === "is_muted") {
|
||||
return;
|
||||
}
|
||||
|
||||
const sub = get_sub_for_target(e.target);
|
||||
const $status_element = $(`#stream_change_property_status${CSS.escape(sub.stream_id)}`);
|
||||
const setting = e.target.name;
|
||||
@@ -562,12 +544,6 @@ export function initialize() {
|
||||
stream_notification_reset,
|
||||
);
|
||||
|
||||
$("#streams_overlay_container").on(
|
||||
"change",
|
||||
"#sub_is_muted_setting .sub_setting_control",
|
||||
stream_is_muted_changed,
|
||||
);
|
||||
|
||||
$("#streams_overlay_container").on(
|
||||
"change",
|
||||
".sub_setting_checkbox .sub_setting_control",
|
||||
|
||||
Reference in New Issue
Block a user