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`.
This commit is contained in:
Lakshay Mittal 2023-04-09 11:23:09 +05:30 committed by Tim Abbott
parent af0b450817
commit 5a89d3b4d2
1 changed files with 6 additions and 3 deletions

View File

@ -240,10 +240,13 @@ export function activate(raw_operators, opts) {
return; return;
} }
const coming_from_recent_topics = recent_topics_util.is_visible();
// The empty narrow is the home view; so deactivate any narrow if // 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) { if (raw_operators.length === 0) {
deactivate(); deactivate(coming_from_recent_topics);
return; return;
} }
@ -406,7 +409,7 @@ export function activate(raw_operators, opts) {
// recursively. // recursively.
reset_ui_state(); reset_ui_state();
if (recent_topics_util.is_visible()) { if (coming_from_recent_topics) {
recent_topics_ui.hide(); recent_topics_ui.hide();
} else { } else {
// If recent topics was not visible, then we are switching // If recent topics was not visible, then we are switching