stream_ui_updates: Only update UI if the stream is being edited.

If the stream settings is open but the stream which was
subscribed/unsubscribed wasn't open (say user unsubscribed
from a different tab), `$settings_button` would
be `undefined` here.
This commit is contained in:
Aman Agrawal 2023-05-30 20:34:49 +00:00 committed by Tim Abbott
parent 173e5389af
commit a47d204ca0
1 changed files with 4 additions and 0 deletions

View File

@ -70,6 +70,10 @@ export function enable_or_disable_subscribers_tab(sub) {
} }
export function update_settings_button_for_sub(sub) { export function update_settings_button_for_sub(sub) {
if (!hash_util.is_editing_stream(sub.stream_id)) {
return;
}
// This is for the Subscribe/Unsubscribe button in the right panel. // This is for the Subscribe/Unsubscribe button in the right panel.
const $settings_button = stream_settings_ui.settings_button_for_sub(sub); const $settings_button = stream_settings_ui.settings_button_for_sub(sub);
if (sub.subscribed) { if (sub.subscribed) {