From 83767282185914d388ae2b98b66057e08fa5aaff Mon Sep 17 00:00:00 2001 From: Sahil Batra Date: Tue, 28 Nov 2023 23:02:30 +0530 Subject: [PATCH] popover: Update popovers shown for unknown users. --- web/src/user_card_popover.js | 27 ++++++++++++++----- .../user_card_popover_for_unknown_user.hbs | 14 ++++++++++ 2 files changed, 34 insertions(+), 7 deletions(-) create mode 100644 web/templates/popovers/user_card/user_card_popover_for_unknown_user.hbs diff --git a/web/src/user_card_popover.js b/web/src/user_card_popover.js index 7ea14f81ad..6848129a9b 100644 --- a/web/src/user_card_popover.js +++ b/web/src/user_card_popover.js @@ -6,6 +6,7 @@ import tippy from "tippy.js"; import render_confirm_mute_user from "../templates/confirm_dialog/confirm_mute_user.hbs"; import render_user_card_popover from "../templates/popovers/user_card/user_card_popover.hbs"; import render_user_card_popover_avatar from "../templates/popovers/user_card/user_card_popover_avatar.hbs"; +import render_user_card_popover_for_unknown_user from "../templates/popovers/user_card/user_card_popover_for_unknown_user.hbs"; import render_user_card_popover_manage_menu from "../templates/popovers/user_card/user_card_popover_manage_menu.hbs"; import * as blueslip from "./blueslip"; @@ -315,12 +316,24 @@ function show_user_card_popover( popover_placement, on_mount, ) { - const args = get_user_card_popover_data( - user, - has_message_context, - is_sender_popover, - private_msg_class, - ); + let popover_html; + let args; + if (user.is_inaccessible_user) { + const sent_by_url = hash_util.by_sender_url(user.email); + args = { + user_id: user.user_id, + sent_by_url, + }; + popover_html = render_user_card_popover_for_unknown_user(args); + } else { + args = get_user_card_popover_data( + user, + has_message_context, + is_sender_popover, + private_msg_class, + ); + popover_html = render_user_card_popover(args); + } popover_menus.toggle_popover_menu( $popover_element[0], @@ -328,7 +341,7 @@ function show_user_card_popover( placement: popover_placement, arrow: false, onCreate(instance) { - instance.setContent(ui_util.parse_html(render_user_card_popover(args))); + instance.setContent(ui_util.parse_html(popover_html)); user_card_popovers[template_class].instance = instance; const $popover = $(instance.popper); diff --git a/web/templates/popovers/user_card/user_card_popover_for_unknown_user.hbs b/web/templates/popovers/user_card/user_card_popover_for_unknown_user.hbs new file mode 100644 index 0000000000..4a75c27326 --- /dev/null +++ b/web/templates/popovers/user_card/user_card_popover_for_unknown_user.hbs @@ -0,0 +1,14 @@ +
+
+ +