Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
hashchange: Go through hashchange to narrow to All messsages.
Aman Agrawal0859a91b1458
diff --git a/frontend_tests/node_tests/hashchange.js b/frontend_tests/node_tests/hashchange.jsindex b0d4ef73efa..e6143d77558 100644--- a/frontend_tests/node_tests/hashchange.js+++ b/frontend_tests/node_tests/hashchange.js@@ -10,7 +10,11 @@ zrequire("people");zrequire("hash_util");zrequire("hashchange");zrequire("stream_data");+zrequire("navigate");+set_global("search", {+ update_button_visibility: () => {},+});set_global("document", "document-stub");set_global("history", {});diff --git a/static/js/click_handlers.js b/static/js/click_handlers.jsindex 8a9c90ecf3b..6f93963edf8 100644--- a/static/js/click_handlers.js+++ b/static/js/click_handlers.js@@ -569,16 +569,6 @@ exports.initialize = function () {// HOME- $(document).on("click", ".top_left_all_messages", (e) => {- ui_util.change_tab_to("#home");- narrow.deactivate();- search.update_button_visibility();- // We need to maybe scroll to the selected message- // once we have the proper viewport set up- setTimeout(navigate.maybe_scroll_to_selected, 0);- e.preventDefault();- });-$(".brand").on("click", (e) => {if (overlays.is_active()) {overlays.close_active();diff --git a/static/js/hashchange.js b/static/js/hashchange.jsindex f82150fa307..4cbab8c4ff6 100644--- a/static/js/hashchange.js+++ b/static/js/hashchange.js@@ -52,6 +52,10 @@ function activate_home_tab() {ui_util.change_tab_to("#home");narrow.deactivate();floating_recipient_bar.update();+ search.update_button_visibility();+ // We need to maybe scroll to the selected message+ // once we have the proper viewport set up+ setTimeout(navigate.maybe_scroll_to_selected, 0);}const state = {diff --git a/static/js/hotkey.js b/static/js/hotkey.jsindex 112037d519f..3e288b14ad1 100644--- a/static/js/hotkey.js+++ b/static/js/hotkey.js@@ -264,7 +264,7 @@ exports.process_escape_key = function (e) {return true;}- narrow.deactivate();+ hashchange.go_to_location("");return true;};diff --git a/static/js/narrow.js b/static/js/narrow.jsindex d414d331872..b4788b0f51e 100644--- a/static/js/narrow.js+++ b/static/js/narrow.js@@ -762,6 +762,9 @@ function handle_post_narrow_deactivate_processes() {}exports.deactivate = function () {+ // NOTE: Never call this function independently,+ // always use hashchange.go_to_location("") to+ // activate All message narrow./*Switches current_msg_list from narrowed_msg_list tohome_msg_list ("All messages"), ending the current narrow. Thisdiff --git a/static/js/search_pill_widget.js b/static/js/search_pill_widget.jsindex cc5f8d6887d..10fd2fcda2e 100644--- a/static/js/search_pill_widget.js+++ b/static/js/search_pill_widget.js@@ -7,8 +7,7 @@ exports.initialize = function () {exports.widget.onPillRemove(() => {if (exports.widget.items().length === 0) {- ui_util.change_tab_to("#home");- narrow.deactivate();+ hashchange.go_to_location("");}});