narrow: Check if coming for `All messages` narrow when deactivating.

This will work correctly as we add more narrows like recent topics.
This commit is contained in:
Aman Agrawal 2023-09-08 06:21:54 +00:00 committed by Tim Abbott
parent a5dafa383c
commit 45491710b7
2 changed files with 3 additions and 3 deletions

View File

@ -110,7 +110,7 @@ export function save_narrow(operators) {
function show_all_message_view() {
const coming_from_recent_view = maybe_hide_recent_view();
const is_actively_scrolling = message_scroll.is_actively_scrolling();
narrow.deactivate(coming_from_recent_view, is_actively_scrolling);
narrow.deactivate(!coming_from_recent_view, is_actively_scrolling);
left_sidebar_navigation_area.handle_narrow_deactivated();
// We need to maybe scroll to the selected message
// once we have the proper viewport set up

View File

@ -1007,7 +1007,7 @@ function handle_post_narrow_deactivate_processes() {
message_feed_top_notices.update_top_of_narrow_notices(message_lists.home);
}
export function deactivate(coming_from_recent_view = false, is_actively_scrolling = false) {
export function deactivate(coming_from_all_messages = true, is_actively_scrolling = false) {
// NOTE: Never call this function independently,
// always use browser_history.go_to_location("#all_messages") to
// activate All message narrow.
@ -1026,7 +1026,7 @@ export function deactivate(coming_from_recent_view = false, is_actively_scrollin
search.clear_search_form();
// Both All messages and Recent Conversations have `undefined` filter.
// Return if already in the All message narrow.
if (narrow_state.filter() === undefined && !coming_from_recent_view) {
if (narrow_state.filter() === undefined && coming_from_all_messages) {
return;
}
blueslip.debug("Unnarrowed");