mirror of
https://github.com/zulip/zulip.git
synced 2025-11-05 06:23:38 +00:00
hashchange: Go through hashchange to narrow to All messsages.
We should not allow every function who wants to narrow to All messages to come up with their own method to do so. This commit makes existing such functions use hashchange library to do so. Remove click event on All message button, it already contains an <a> tag which navigates correctly.
This commit is contained in:
@@ -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", {});
|
||||
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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 = {
|
||||
|
||||
@@ -264,7 +264,7 @@ exports.process_escape_key = function (e) {
|
||||
return true;
|
||||
}
|
||||
|
||||
narrow.deactivate();
|
||||
hashchange.go_to_location("");
|
||||
return true;
|
||||
};
|
||||
|
||||
|
||||
@@ -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 to
|
||||
home_msg_list ("All messages"), ending the current narrow. This
|
||||
|
||||
@@ -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("");
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user