stream_settings: Fix stream row switching behavior.

Add a rule to the switch_rows(event) function to avoid
switching stream row when pressing up/down key by checking
the current URL hash and the add_subscribers_pill focus state.
Add a utility function to hash_parser to help implement new
switch_rows behavior mentioned above.

Fixes #29690.
This commit is contained in:
PieterCK
2024-04-25 17:34:44 +07:00
committed by Tim Abbott
parent 480bceae98
commit 2457a8b655
3 changed files with 38 additions and 0 deletions

View File

@@ -91,6 +91,20 @@ export function is_create_new_stream_narrow(): boolean {
return window.location.hash === "#streams/new";
}
// This checks whether the user is in the stream settings menu
// and is opening the 'Subscribers' tab on the right panel.
export function is_subscribers_section_opened_for_stream(): boolean {
const hash_components = window.location.hash.slice(1).split(/\//);
if (hash_components[0] !== "streams") {
return false;
}
if (!hash_components[3]) {
return false;
}
return hash_components[3] === "subscribers";
}
export const allowed_web_public_narrows = [
"channels",
"channel",