user_card_popover: Fix bug where owner's avatar replaces bot's avatar.

The `.popover-menu-user-avatar` selector being used to replace the small
avatar with the medium avatar was a broad selector, which also targeted
the bot's avatar when the bot owner's user card was opened. This commit
fixes this bug by scoping the selector to the current popover instance.
This commit is contained in:
Sayam Samal 2024-07-24 17:07:58 +05:30 committed by Tim Abbott
parent 8734d34cb7
commit 9b314da0ea
1 changed files with 2 additions and 1 deletions

View File

@ -334,6 +334,7 @@ function show_user_card_popover(
if (on_mount) {
on_mount(instance);
}
const $popover = $(instance.popper);
// Note: We pass the normal-size avatar in initial rendering, and
// then query the server to replace it with the medium-size
// avatar. The purpose of this double-fetch approach is to take
@ -341,7 +342,7 @@ function show_user_card_popover(
// low-resolution image cached and thus display a low-resolution
// avatar rather than a blank area during the network delay for
// fetching the medium-size one.
load_medium_avatar(user, $(".popover-menu-user-avatar"));
load_medium_avatar(user, $popover.find(".popover-menu-user-avatar"));
init_email_clipboard();
init_email_tooltip(user);
},