mirror of
				https://github.com/zulip/zulip.git
				synced 2025-11-03 21:43:21 +00:00 
			
		
		
		
	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:
		@@ -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() {
 | 
			
		||||
    remove($(".top_left_all_messages"));
 | 
			
		||||
    remove($(".top_left_starred_messages"));
 | 
			
		||||
 
 | 
			
		||||
@@ -561,7 +561,6 @@ export function activate(raw_operators, opts) {
 | 
			
		||||
 | 
			
		||||
        const current_filter = narrow_state.filter();
 | 
			
		||||
 | 
			
		||||
        left_sidebar_navigation_area.handle_narrow_activated(current_filter);
 | 
			
		||||
        pm_list.handle_narrow_activated(current_filter);
 | 
			
		||||
        stream_list.handle_narrow_activated(current_filter);
 | 
			
		||||
        unread_ui.update_unread_banner();
 | 
			
		||||
@@ -1021,6 +1020,7 @@ function handle_post_view_change(msg_list) {
 | 
			
		||||
 | 
			
		||||
    message_view_header.render_title_area();
 | 
			
		||||
    update_narrow_title(filter);
 | 
			
		||||
    left_sidebar_navigation_area.handle_narrow_activated(filter);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
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();
 | 
			
		||||
 | 
			
		||||
    left_sidebar_navigation_area.handle_narrow_deactivated();
 | 
			
		||||
    pm_list.handle_narrow_deactivated();
 | 
			
		||||
    stream_list.handle_narrow_deactivated();
 | 
			
		||||
    message_edit.handle_narrow_deactivated();
 | 
			
		||||
 
 | 
			
		||||
@@ -35,9 +35,9 @@ run_test("narrowing", () => {
 | 
			
		||||
 | 
			
		||||
    // 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_starred_messages").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_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();
 | 
			
		||||
    assert.ok(!$(".top_left_all_messages").hasClass("active-filter"));
 | 
			
		||||
    assert.ok(!$(".top_left_mentions").hasClass("active-filter"));
 | 
			
		||||
 
 | 
			
		||||
@@ -194,8 +194,8 @@ run_test("basics", ({override}) => {
 | 
			
		||||
        [compose_closed_ui, "update_reply_recipient_label"],
 | 
			
		||||
        [message_view_header, "render_title_area"],
 | 
			
		||||
        [notifications, "redraw_title"],
 | 
			
		||||
        [compose_actions, "on_narrow"],
 | 
			
		||||
        [left_sidebar_navigation_area, "handle_narrow_activated"],
 | 
			
		||||
        [compose_actions, "on_narrow"],
 | 
			
		||||
        [stream_list, "handle_narrow_activated"],
 | 
			
		||||
        [compose_recipient, "update_narrow_to_recipient_visibility"],
 | 
			
		||||
    ]);
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user