popovers: Link subscribed users to user cards.

This links users or bots in Stream settings -> Subscribed users, to
their respective user profile card.

Also, changes were made to close any active overlay, on clicking any of
the PM buttons in the user profile card. This help us avoid writing
separate conditions for multiple overlays, like settings overlay or
stream settings overlay.

Fixes part of #18880.
This commit is contained in:
SameepAher 2023-01-21 11:39:23 +05:30 committed by Tim Abbott
parent db7d2169b3
commit bbf5b3d6ce
2 changed files with 8 additions and 7 deletions

View File

@ -816,8 +816,8 @@ export function register_click_handlers() {
const user_id = elem_to_user_id($(e.target).parents("ul"));
const email = people.get_by_user_id(user_id).email;
hide_all();
if (overlays.settings_open()) {
overlays.close_overlay("settings");
if (overlays.is_active()) {
overlays.close_active();
}
narrow.by("pm-with", email, {trigger: "user sidebar popover"});
e.stopPropagation();
@ -828,8 +828,8 @@ export function register_click_handlers() {
const user_id = elem_to_user_id($(e.target).parents("ul"));
const email = people.get_by_user_id(user_id).email;
hide_all();
if (overlays.settings_open()) {
overlays.close_overlay("settings");
if (overlays.is_active()) {
overlays.close_active();
}
narrow.by("sender", email, {trigger: "user sidebar popover"});
e.stopPropagation();
@ -1055,8 +1055,8 @@ export function register_click_handlers() {
private_message_recipient: email,
});
hide_all();
if (overlays.settings_open()) {
overlays.close_overlay("settings");
if (overlays.is_active()) {
overlays.close_active();
}
e.stopPropagation();
e.preventDefault();

View File

@ -1,6 +1,7 @@
<tr data-subscriber-id="{{user_id}}">
<td class="subscriber-name">
{{name}}{{#if is_current_user}} <span class="my_user_status">{{t "(you)"}}</span>{{/if}}
<a data-user-id="{{user_id}}" class="view_user_profile" tabindex="0">{{name}}</a>
{{#if is_current_user}} <span class="my_user_status">{{t "(you)"}}</span>{{/if}}
</td>
{{#if show_email}}
<td class="subscriber-email">{{email}}</td>