From e360a896f6051a9edafbf23fe6f1cffa62b37056 Mon Sep 17 00:00:00 2001 From: evykassirer Date: Tue, 20 Jun 2023 19:26:37 -0700 Subject: [PATCH] message view header: Don't initalize multiple times. The `initialize` function registers a click handler, and previously it was being registered another time each time one of these calls to `initialize()` happened. The only other thing that happens in `initialize` is a call to `render_title_area`, so this commit replaces the extra calls to initialize with that. --- web/src/narrow.js | 4 ++-- web/tests/narrow_activate.test.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/web/src/narrow.js b/web/src/narrow.js index 6fb2bea434..b6576718dd 100644 --- a/web/src/narrow.js +++ b/web/src/narrow.js @@ -549,7 +549,7 @@ export function activate(raw_operators, opts) { pm_list.handle_narrow_activated(current_filter); stream_list.handle_narrow_activated(current_filter); typing_events.render_notifications_for_narrow(); - message_view_header.initialize(); + message_view_header.render_title_area(); unread_ui.update_unread_banner(); // It is important to call this after other important updates @@ -991,7 +991,7 @@ function handle_post_narrow_deactivate_processes() { message_edit.handle_narrow_deactivated(); widgetize.set_widgets_for_list(); typing_events.render_notifications_for_narrow(); - message_view_header.initialize(); + message_view_header.render_title_area(); update_narrow_title(narrow_state.filter()); message_feed_top_notices.update_top_of_narrow_notices(message_lists.home); } diff --git a/web/tests/narrow_activate.test.js b/web/tests/narrow_activate.test.js index 37aa114892..add322e10c 100644 --- a/web/tests/narrow_activate.test.js +++ b/web/tests/narrow_activate.test.js @@ -90,7 +90,7 @@ function test_helper() { stub(notifications, "redraw_title"); stub(search, "update_button_visibility"); stub(stream_list, "handle_narrow_activated"); - stub(message_view_header, "initialize"); + stub(message_view_header, "render_title_area"); stub(top_left_corner, "handle_narrow_activated"); stub(typing_events, "render_notifications_for_narrow"); stub(compose_recipient, "update_narrow_to_recipient_visibility"); @@ -198,7 +198,7 @@ run_test("basics", () => { [top_left_corner, "handle_narrow_activated"], [stream_list, "handle_narrow_activated"], [typing_events, "render_notifications_for_narrow"], - [message_view_header, "initialize"], + [message_view_header, "render_title_area"], [compose_recipient, "update_narrow_to_recipient_visibility"], ]);