popover: Update popovers shown for unknown users.

This commit is contained in:
Sahil Batra 2023-11-28 23:02:30 +05:30 committed by Tim Abbott
parent 380ff91c0e
commit 8376728218
2 changed files with 34 additions and 7 deletions

View File

@ -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);

View File

@ -0,0 +1,14 @@
<div class="user-card-popover-title no-auto-hide-right-sidebar-overlay"></div>
<div class="user-card-popover-content no-auto-hide-right-sidebar-overlay">
<ul class="nav nav-list user-card-popover-actions" id="user_card_popover" data-user-id="{{user_id}}">
<li class="popover_user_name_row">
<b class="user_full_name" data-tippy-content="{{t 'Unknown user' }}">{{t "Unknown user" }}</b>
</li>
<hr/>
<li>
<a href="{{ sent_by_url }}" class="narrow_to_messages_sent">
<i class="fa fa-paper-plane" aria-hidden="true"></i> {{t "View messages sent" }}
</a>
</li>
</ul>
</div>