From bbf5b3d6cede958a5a0e223605a2f47a11d9809c Mon Sep 17 00:00:00 2001 From: SameepAher Date: Sat, 21 Jan 2023 11:39:23 +0530 Subject: [PATCH] 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. --- static/js/popovers.js | 12 ++++++------ .../stream_settings/stream_member_list_entry.hbs | 3 ++- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/static/js/popovers.js b/static/js/popovers.js index 9e4d968285..9448420e07 100644 --- a/static/js/popovers.js +++ b/static/js/popovers.js @@ -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(); diff --git a/static/templates/stream_settings/stream_member_list_entry.hbs b/static/templates/stream_settings/stream_member_list_entry.hbs index 20bccc5325..5cee339a1a 100644 --- a/static/templates/stream_settings/stream_member_list_entry.hbs +++ b/static/templates/stream_settings/stream_member_list_entry.hbs @@ -1,6 +1,7 @@ - {{name}}{{#if is_current_user}} {{t "(you)"}}{{/if}} + {{name}} + {{#if is_current_user}} {{t "(you)"}}{{/if}} {{#if show_email}} {{email}}