left_sidebar: Deduplicate handle_narrow_deactivated.

handle_narrow_activated did the same thing is passed the home_msg_list
filter.
This commit is contained in:
Tim Abbott 2023-10-03 17:52:04 -07:00
parent 246139e1d0
commit 20b2323c67
4 changed files with 5 additions and 13 deletions

View File

@ -81,13 +81,6 @@ export function handle_narrow_activated(filter) {
} }
} }
export function handle_narrow_deactivated() {
deselect_top_left_corner_items();
const $filter_li = $(".top_left_all_messages");
$filter_li.addClass("active-filter");
}
export function highlight_recent_view() { export function highlight_recent_view() {
remove($(".top_left_all_messages")); remove($(".top_left_all_messages"));
remove($(".top_left_starred_messages")); remove($(".top_left_starred_messages"));

View File

@ -561,7 +561,6 @@ export function activate(raw_operators, opts) {
const current_filter = narrow_state.filter(); const current_filter = narrow_state.filter();
left_sidebar_navigation_area.handle_narrow_activated(current_filter);
pm_list.handle_narrow_activated(current_filter); pm_list.handle_narrow_activated(current_filter);
stream_list.handle_narrow_activated(current_filter); stream_list.handle_narrow_activated(current_filter);
unread_ui.update_unread_banner(); unread_ui.update_unread_banner();
@ -1021,6 +1020,7 @@ function handle_post_view_change(msg_list) {
message_view_header.render_title_area(); message_view_header.render_title_area();
update_narrow_title(filter); update_narrow_title(filter);
left_sidebar_navigation_area.handle_narrow_activated(filter);
} }
function handle_post_narrow_deactivate_processes(msg_list) { function handle_post_narrow_deactivate_processes(msg_list) {
@ -1028,7 +1028,6 @@ function handle_post_narrow_deactivate_processes(msg_list) {
compose_fade.update_message_list(); compose_fade.update_message_list();
left_sidebar_navigation_area.handle_narrow_deactivated();
pm_list.handle_narrow_deactivated(); pm_list.handle_narrow_deactivated();
stream_list.handle_narrow_deactivated(); stream_list.handle_narrow_deactivated();
message_edit.handle_narrow_deactivated(); message_edit.handle_narrow_deactivated();

View File

@ -35,9 +35,9 @@ run_test("narrowing", () => {
// deactivating narrow // deactivating narrow
left_sidebar_navigation_area.handle_narrow_deactivated(); left_sidebar_navigation_area.handle_narrow_activated(new Filter());
assert.ok($(".top_left_all_messages").hasClass("active-filter")); assert.ok(!$(".top_left_all_messages").hasClass("active-filter"));
assert.ok(!$(".top_left_mentions").hasClass("active-filter")); assert.ok(!$(".top_left_mentions").hasClass("active-filter"));
assert.ok(!$(".top_left_starred_messages").hasClass("active-filter")); assert.ok(!$(".top_left_starred_messages").hasClass("active-filter"));
assert.ok(!$(".top_left_recent_view").hasClass("active-filter")); assert.ok(!$(".top_left_recent_view").hasClass("active-filter"));
@ -53,7 +53,7 @@ run_test("narrowing", () => {
assert.ok(!$(".top_left_inbox").hasClass("active-filter")); assert.ok(!$(".top_left_inbox").hasClass("active-filter"));
assert.ok($(".top_left_recent_view").hasClass("active-filter")); assert.ok($(".top_left_recent_view").hasClass("active-filter"));
left_sidebar_navigation_area.handle_narrow_deactivated(); left_sidebar_navigation_area.handle_narrow_activated(new Filter());
left_sidebar_navigation_area.highlight_inbox_view(); left_sidebar_navigation_area.highlight_inbox_view();
assert.ok(!$(".top_left_all_messages").hasClass("active-filter")); assert.ok(!$(".top_left_all_messages").hasClass("active-filter"));
assert.ok(!$(".top_left_mentions").hasClass("active-filter")); assert.ok(!$(".top_left_mentions").hasClass("active-filter"));

View File

@ -194,8 +194,8 @@ run_test("basics", ({override}) => {
[compose_closed_ui, "update_reply_recipient_label"], [compose_closed_ui, "update_reply_recipient_label"],
[message_view_header, "render_title_area"], [message_view_header, "render_title_area"],
[notifications, "redraw_title"], [notifications, "redraw_title"],
[compose_actions, "on_narrow"],
[left_sidebar_navigation_area, "handle_narrow_activated"], [left_sidebar_navigation_area, "handle_narrow_activated"],
[compose_actions, "on_narrow"],
[stream_list, "handle_narrow_activated"], [stream_list, "handle_narrow_activated"],
[compose_recipient, "update_narrow_to_recipient_visibility"], [compose_recipient, "update_narrow_to_recipient_visibility"],
]); ]);