stream settings: Fix archiving of a stream opened in right panel.

We expect the URL to be of stream if it is opened in right panel.
As archiving a stream extracts stream id from hash,
but while a stream is opened and we switch between `All Streams` or
`Subscribed` tabs, the url changes, causing bug in archiving the stream.

As as fix for this issue if a stream is opened in the right
panel the hash of the URL remain of the stream and doesn't update.
If it is archived then the URL updates accordingly.

Fixes #23855.
This commit is contained in:
aparna-bhatt
2023-03-09 23:33:05 +05:30
committed by Tim Abbott
parent 344d26d936
commit 710e42f862

View File

@@ -47,6 +47,9 @@ function setup_subscriptions_stream_hash(sub) {
}
export function setup_subscriptions_tab_hash(tab_key_value) {
if ($("#subscription_overlay .right").hasClass("show")) {
return;
}
if (tab_key_value === "all-streams") {
browser_history.update("#streams/all");
} else if (tab_key_value === "subscribed") {
@@ -102,6 +105,7 @@ export function open_edit_panel_for_row(stream_row) {
export function open_edit_panel_empty() {
const tab_key = stream_settings_ui.get_active_data().$tabs.first().attr("data-tab-key");
$(".stream-row.active").removeClass("active");
$("#subscription_overlay .right").removeClass("show");
stream_settings_ui.show_subs_pane.nothing_selected();
setup_subscriptions_tab_hash(tab_key);
}