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 <pieterceka123@gmail.com>.
This commit is contained in:
ecxtacy 2024-02-04 23:08:03 +05:30 committed by Tim Abbott
parent 82a817aaab
commit ac7dd6fa08
1 changed files with 14 additions and 2 deletions

View File

@ -53,10 +53,12 @@ export function handle_keyboard(key: string): void {
} }
// element is the target element to pop off of; // 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( export function toggle_user_group_info_popover(
element: ReferenceElement, element: ReferenceElement,
message_id: number, message_id: number | undefined,
): void { ): void {
if (is_open()) { if (is_open()) {
hide(); hide();
@ -130,6 +132,16 @@ export function register_click_handlers(): void {
blueslip.info("Unable to find user group in message" + message.sender_id); 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[] { function fetch_group_members(member_ids: number[]): PopoverGroupMember[] {