message_events: Check is_message_feed_visible in callbacks.

Because we don't call this function with home_msg_list, I believe the
existing msg_list !== message_lists.current check would have always
been false when the new check is false, but this is more explicit
about the logical intent.
This commit is contained in:
Tim Abbott 2023-02-23 11:14:29 -08:00
parent 2ebb9834cd
commit f165e59273
1 changed files with 3 additions and 3 deletions

View File

@ -47,8 +47,8 @@ function maybe_add_narrowed_messages(messages, msg_list, callback, attempt = 1)
},
timeout: 5000,
success(data) {
if (msg_list !== message_lists.current) {
// We unnarrowed in the mean time
if (!narrow_state.is_message_feed_visible() || msg_list !== message_lists.current) {
// We unnarrowed or moved to Recent Topics in the meantime.
return;
}
@ -81,7 +81,7 @@ function maybe_add_narrowed_messages(messages, msg_list, callback, attempt = 1)
notifications.notify_messages_outside_current_search(elsewhere_messages);
},
error(xhr) {
if (msg_list.narrowed && msg_list !== message_lists.current) {
if (!narrow_state.is_message_feed_visible() || msg_list !== message_lists.current) {
return;
}
if (xhr.status === 400) {