From 70748181daf20577e97c90aa0e27d3f9f475dfb7 Mon Sep 17 00:00:00 2001 From: Anders Kaseorg Date: Fri, 6 Oct 2023 18:32:53 -0700 Subject: [PATCH] recent_view_ui: Cut import of user_card_popover. Signed-off-by: Anders Kaseorg --- web/src/recent_view_ui.js | 6 ++---- web/src/ui_init.js | 7 ++++++- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/web/src/recent_view_ui.js b/web/src/recent_view_ui.js index c0da7fc137..ec467dbbe7 100644 --- a/web/src/recent_view_ui.js +++ b/web/src/recent_view_ui.js @@ -34,7 +34,6 @@ import * as timerender from "./timerender"; import * as ui_util from "./ui_util"; import * as unread from "./unread"; import * as unread_ops from "./unread_ops"; -import * as user_card_popover from "./user_card_popover"; import * as user_status from "./user_status"; import * as user_topics from "./user_topics"; import * as views_util from "./views_util"; @@ -1245,7 +1244,7 @@ export function change_focused_element($elt, input_key) { return false; } -export function initialize() { +export function initialize({on_click_participant}) { // load filters from local storage. if (!page_params.is_spectator) { // A user may have a stored filter and can log out @@ -1257,8 +1256,7 @@ export function initialize() { $("body").on("click", "#recent_view_table .recent_view_participant_avatar", function (e) { const participant_user_id = Number.parseInt($(this).parent().attr("data-user-id"), 10); e.stopPropagation(); - const user = people.get_by_user_id(participant_user_id); - user_card_popover.toggle_user_card_popover(this, user); + on_click_participant(this, participant_user_id); }); $("body").on( diff --git a/web/src/ui_init.js b/web/src/ui_init.js index d9070ab6da..3ab3316b5e 100644 --- a/web/src/ui_init.js +++ b/web/src/ui_init.js @@ -592,7 +592,12 @@ export function initialize_everything() { realm_logo.initialize(); message_lists.initialize(); message_list.initialize(); - recent_view_ui.initialize(); + recent_view_ui.initialize({ + on_click_participant(avatar_element, participant_user_id) { + const user = people.get_by_user_id(participant_user_id); + user_card_popover.toggle_user_card_popover(avatar_element, user); + }, + }); inbox_ui.initialize(); alert_words.initialize(alert_words_params); emojisets.initialize();