From ac7dd6fa08fa70374da1f631f28f996d1e540760 Mon Sep 17 00:00:00 2001 From: ecxtacy Date: Sun, 4 Feb 2024 23:08:03 +0530 Subject: [PATCH] settings: Show user_group_popover when pill is clicked. Add 'click' event listener to the pills in stream settings to toggle the user_group_info_popover. Fixes #28687. Co-authored-by: Pieter CK . --- web/src/user_group_popover.ts | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/web/src/user_group_popover.ts b/web/src/user_group_popover.ts index 9ab7ddfa2f..385a5b532b 100644 --- a/web/src/user_group_popover.ts +++ b/web/src/user_group_popover.ts @@ -53,10 +53,12 @@ export function handle_keyboard(key: string): void { } // element is the target element to pop off of; -// message_id is the message id containing it, which should be selected; +// the element could be user group pill or mentions in a message; +// in case of message, message_id is the message id containing it; +// in case of user group pill, message_id is not used; export function toggle_user_group_info_popover( element: ReferenceElement, - message_id: number, + message_id: number | undefined, ): void { if (is_open()) { hide(); @@ -130,6 +132,16 @@ export function register_click_handlers(): void { blueslip.info("Unable to find user group in message" + message.sender_id); } }); + + // Show the user_group_popover when pill clicked in subscriber settings. + $("body").on( + "click", + ".person_picker .pill[data-user-group-id]", + function (this: HTMLElement, e) { + e.stopPropagation(); + toggle_user_group_info_popover(this, undefined); + }, + ); } function fetch_group_members(member_ids: number[]): PopoverGroupMember[] {