From 5a89d3b4d2f932ee2fc7c09857a10d7be6b4c4b9 Mon Sep 17 00:00:00 2001 From: Lakshay Mittal Date: Sun, 9 Apr 2023 11:23:09 +0530 Subject: [PATCH] search: Fix selecting all messages from recent conversations. When there are no operators to narrow down the search to, pass into `deactivate()` if we're in `recent conversations`. If we are, it will go to `all messages`. This is done by using `is_visible()` function of `recent_topics_util`. --- web/src/narrow.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/web/src/narrow.js b/web/src/narrow.js index a282e53807..3d02acbd75 100644 --- a/web/src/narrow.js +++ b/web/src/narrow.js @@ -240,10 +240,13 @@ export function activate(raw_operators, opts) { return; } + const coming_from_recent_topics = recent_topics_util.is_visible(); + // The empty narrow is the home view; so deactivate any narrow if - // no operators were specified. + // no operators were specified. Take us to all messages when this + // happens from recent conversations view. if (raw_operators.length === 0) { - deactivate(); + deactivate(coming_from_recent_topics); return; } @@ -406,7 +409,7 @@ export function activate(raw_operators, opts) { // recursively. reset_ui_state(); - if (recent_topics_util.is_visible()) { + if (coming_from_recent_topics) { recent_topics_ui.hide(); } else { // If recent topics was not visible, then we are switching