narrow: Show empty narrow banner if all topics muted in stream.

Adjusts the check in `message_filter.process_results` to happen
after the messages have been processed so that the empty narrow
banner is shown if there are no messages in the current message
list, which covers the case of there being no messages returned
from the server (e.g. a keyword search, no private messages with
a user) and the case of all existing stream topics being muted
by the current user.
This commit is contained in:
Lauryn Menard 2022-11-16 21:44:33 +01:00 committed by Tim Abbott
parent 7e1fe7e569
commit 16c45aaf42
1 changed files with 6 additions and 10 deletions

View File

@ -37,16 +37,6 @@ function process_result(data, opts) {
ui_report.hide_error($("#connection-error"));
}
if (
messages.length === 0 &&
message_lists.current === message_list.narrowed &&
message_list.narrowed.empty()
) {
// Even after trying to load more messages, we have no
// messages to display in this narrow.
narrow_banner.show_empty_narrow_message();
}
messages = messages.map((message) => message_helper.process_new_message(message));
// In some rare situations, we expect to discover new unread
@ -64,6 +54,12 @@ function process_result(data, opts) {
message_util.add_old_messages(messages, opts.msg_list);
}
if (message_lists.current === message_list.narrowed && message_list.narrowed.empty()) {
// Even after loading more messages, we have
// no messages to display in this narrow.
narrow_banner.show_empty_narrow_message();
}
huddle_data.process_loaded_messages(messages);
stream_list.update_streams_sidebar();
recent_topics_ui.process_messages(messages);