Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
hash: Fix navigation issue with negated operators.
opmkumar85eb8e554f21
diff --git a/web/src/hash_parser.ts b/web/src/hash_parser.tsindex b9011d1d2b1..dcc2ac5f50c 100644--- a/web/src/hash_parser.ts+++ b/web/src/hash_parser.ts@@ -160,7 +160,10 @@ export function is_spectator_compatible(hash: string): boolean {const main_hash = get_hash_category(hash);if (main_hash === "narrow") {- const hash_section = get_hash_section(hash);+ let hash_section = get_hash_section(hash);+ if (hash_section.startsWith("-")) {+ hash_section = hash_section.slice(1);+ }if (!is_an_allowed_web_public_narrow(hash_section)) {return false;}diff --git a/web/tests/hashchange.test.cjs b/web/tests/hashchange.test.cjsindex 99ddcb9d5b7..d698ee2f7b0 100644--- a/web/tests/hashchange.test.cjs+++ b/web/tests/hashchange.test.cjs@@ -443,4 +443,11 @@ run_test("update_hash_to_match_filter", ({override, override_rewire}) => {message_view.update_hash_to_match_filter(new Filter(terms));helper.assert_events([[message_viewport, "stop_auto_scrolling"]]);assert.equal(url_pushed, "http://zulip.zulipdev.com/#narrow/is/starred");++ terms = [{operator: "-is", operand: "starred"}];++ helper.clear_events();+ message_view.update_hash_to_match_filter(new Filter(terms));+ helper.assert_events([[message_viewport, "stop_auto_scrolling"]]);+ assert.equal(url_pushed, "http://zulip.zulipdev.com/#narrow/-is/starred");});