Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
hashchange: Don't narrow to default_view on `#reload`.
Aman Agrawalcb2d95d9adea
diff --git a/frontend_tests/node_tests/hashchange.js b/frontend_tests/node_tests/hashchange.jsindex ecdd6f62a6f..e1a32c084e9 100644--- a/frontend_tests/node_tests/hashchange.js+++ b/frontend_tests/node_tests/hashchange.js@@ -188,7 +188,6 @@ run_test("hash_interactions", ({override}) => {[message_viewport, "stop_auto_scrolling"],]);- override(recent_topics_ui, "show", () => {});window.location.hash = "#all_messages";helper.clear_events();@@ -248,6 +247,15 @@ run_test("hash_interactions", ({override}) => {[subs, "launch"],]);+ recent_topics_ui_shown = false;+ window.location.hash = "#reload:send_after_reload=0...";++ helper.clear_events();+ window_stub.trigger("hashchange");+ helper.assert_events([]);+ // If it's reload hash it shouldn't show the default view.+ assert.equal(recent_topics_ui_shown, false);+window.location.hash = "#keyboard-shortcuts/whatever";helper.clear_events();diff --git a/static/js/hashchange.js b/static/js/hashchange.jsindex 5b2723e641d..085e17b0e17 100644--- a/static/js/hashchange.js+++ b/static/js/hashchange.js@@ -128,6 +128,7 @@ function do_hashchange_normal(from_reload) {// Even if the URL bar says #%41%42%43%44, the value here will// be #ABCD.const hash = window.location.hash.split("/");+switch (hash[0]) {case "#narrow": {maybe_hide_recent_topics();@@ -314,6 +315,13 @@ function hashchanged(from_reload, e) {return undefined;}+ // TODO: Migrate the `#reload` syntax to use slashes as separators+ // so that this can be part of the main switch statement.+ if (window.location.hash.startsWith("#reload")) {+ // We don't want to change narrow if app is undergoing reload.+ return undefined;+ }+if (hash_util.is_overlay_hash(window.location.hash)) {browser_history.state.changing_hash = true;do_hashchange_overlay(old_hash);