left_sidebar: Fix DM row highlight linger on narrowing away.

Earlier, DM row remained highlighted when narrowed to different
part of left sidebar other than recent and inbox since on narrow
event, `handle_narrow_activate` wasn't properly handling unnarrow
events. It wasn't calling `update_private_messages` to update the
state of the DM list.

This commit fixes the behaviour by updating the state on narrowing
away from DM rows.

Fixes: zulip#27698.

Co-authored-by: Rinwaoluwa <peterodejobi9@gmail.com>
(cherry picked from commit 0708505acb)
This commit is contained in:
Pratik Chanda
2024-03-28 03:17:57 +05:30
committed by Tim Abbott
parent 5a61c2dde0
commit 783a2a3f27

View File

@@ -143,6 +143,7 @@ export function handle_narrow_activated(filter) {
const active_filter = filter;
const is_all_private_message_view = _.isEqual(active_filter.sorted_term_types(), ["is-dm"]);
const narrow_to_private_messages_section = active_filter.operands("dm").length !== 0;
const is_private_messages_in_view = active_filter.has_operator("dm");
if (is_all_private_message_view) {
// In theory, this should get expanded when we scroll to the
@@ -161,6 +162,8 @@ export function handle_narrow_activated(filter) {
);
scroll_pm_into_view($active_filter_li);
update_private_messages();
} else if (!is_private_messages_in_view) {
update_private_messages();
}
}