-
-
Notifications
You must be signed in to change notification settings - Fork 7.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
popover: Fix user pop over not showing when clicked in channels /group settings #29898
popover: Fix user pop over not showing when clicked in channels /group settings #29898
Conversation
Hello @zulip/server-settings members, this pull request was labeled with the "area: settings UI" label, so you may want to check it out! |
718ebcd
to
dde88c0
Compare
umm, hello @ecxtacy. I think I did an oopsie by mentioning(@) you in the PR commits. I think you'll get notifications eveytime I push something here. I'm not sure whether that stays true even if I've changed the commit descriptions to not mention you. Sorry for that, let me know if you need help turning it off π |
dde88c0
to
eebcc51
Compare
web/src/input_pill.ts
Outdated
@@ -19,6 +19,8 @@ export type InputPillItem<T> = { | |||
deactivated?: boolean; | |||
status_emoji_info?: EmojiRenderingDetails & {emoji_alt_code?: boolean}; // TODO: Move this in user_status.js | |||
should_add_guest_user_indicator?: boolean; | |||
user_id?: number; | |||
id?: number; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Original Review:
sahil: Why not group_id here instead of id?
Hi Sahil, it's because user_group_pill.ts
used id
instead if group_id
. I also agree that it be group_id
, consistent with user_id
instead of just id
. I can add it as a prep commit in this PR if you think we should make the change
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I think group_id
is better and you can do that change in a prep commit.
web/templates/input_pill.hbs
Outdated
@@ -1,4 +1,4 @@ | |||
<div class='pill {{#if deactivated}} deactivated-pill {{/if}}' tabindex=0> | |||
<div class='pill {{#if deactivated}} deactivated-pill {{/if}}'{{#if user_id}}data-user-id="{{user_id}}"{{/if}}{{#if group_id}}data-group-id="{{group_id}}"{{/if}} tabindex=0> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Original Review:
sahil: I think we should name these attributes to data-user-id and data-group-id.
Changed it!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess we use data-user-group-id
in user_group.toggle_user_group_info_popover
, so we might use data-user-group-id
here as well.
web/src/user_card_popover.js
Outdated
}); | ||
$("body").on( | ||
"click", | ||
".view_user_profile, .pill-container.person_picker > .pill[data-user-id]", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the original PR, there's a new separate function responsible for adding events listeners to the pill on stream and group settings. It was on line 885 in web/src/user_card_popover.js
. However, it introduced a new bug where clicking some user pill pops up two popovers since it's targeted by both event listeners. So, I extended the selector to this event listener instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess that was due to the selector being used in the original PR. I imagine in future we would just add a common class to all the user pills when we want to show the popover for all pills with proper testing.
This seems fine for now though. Or maybe you can just use .person_picker .pill[data-user-id]
selector.
web/src/user_group_popover.ts
Outdated
@@ -130,6 +140,17 @@ 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", ".pill-container.person_picker > .pill[data-group-id]", (e) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Narrowed down the JQuery selector targeting the pill.
Original: .pill[group-id]
2fe5403
to
f293cd6
Compare
f293cd6
to
b6557e9
Compare
4f15dfb
to
00caaf0
Compare
00caaf0
to
02a8d15
Compare
Update: Edited the PR description, added new changes to the PR addressing reviews from the original PR and highlighted those changes through PR comments. |
Sorry for notifying a sloppy PR, I've improved the PR description and commented on the new changes. I believe it's clearer now. Thank you as always! π |
6d5201c
to
4e365c4
Compare
4c72be7
to
f8a7d51
Compare
Update: Addressed reviews. Having trouble trying to resolve the failing tests though, looks like it failed during provisioning. Any advice? |
Yeah, looks like some issue during provisioning (can happen sometimes; nothing to worry about). You can re-run the tests by force-pushing your commits again. Do it by amending your last commit's message using |
6c28e20
to
587d6d2
Compare
Aha, all good. Thanks! |
Code looks good. @alya this is ready for testing. A couple of points -
|
Also, there is a PR #24334, which adds support for opening the popover for all the pills. This PR can be followed by completing that PR. |
@PieterCK Please bump for my review once conflicts are resolved. |
Added new utility function to hash_parser to dynamically detect the hash category of an URL. This is intended to reduce the need of adding more adhoc hash_parser utility functions.
When input pills are hovered, the 'x' button is highlighted. This commit ensures that 'x' button is highlighted only if the 'x' button is hovered, not anywhere else on the pill. Author: ecxtacy <[email protected]>.
Changed UserGroupPill's 'id' key to 'group_id' because UserPill uses 'user_id' instead of only id.
While rendering input pills in input_pills.create function, pass in the user_id or group_id accordingly. Display the id as an html attribute in input_pill.hbs. Co-authored-by: Pieter CK <[email protected]>.
Add a 'click' event listener to the user pills in stream and group settings which toggles the user_card_popover. Co-authored-by: PieterCK <[email protected]>.
Refactored hashchanged() so that popover.hide_all() is executed before checking is_overlay_hash() to close popovers when the user changes hash but still on overlay.
Add 'click' event listener to the pills in stream settings to toggle the user_group_info_popover. Fixes zulip#28687. Co-authored-by: Pieter CK <[email protected]>.
The removePill function of input_pill module uses a for loop for iterating and finding the required pill. Replace the for loop with inbuilt findIndex function for efficiency. Authored-by: Dhruv Chouhan <[email protected]>.
587d6d2
to
fc4a014
Compare
Resolved merge conflict. @alya this is ready for testing |
Works for me in manual testing! |
@timabbott This PR addresses @sahil839 's feedback on an earlier PR. |
π Overview
This PR aims to continue where #28820 has left off. The changes introduced in my PR are primarily fixes addressing the comments left by reviewer in the original PR.
Details of the original PR by Ecxtacy:
removePill
function ofinput_pill.ts
module as discussed in the CZO.New changes in this PR is detailed in the PR comments I've highlighted in the code.
Fixes: #28687
Screenshots and screen captures:
Popovers on user and group pills in channel and group menu:
Relevant commits for this change:
input_pill: Pass user_id and group_id to render pill.
settings: Show user_card_popover when pill is clicked.
popovers: Refactor user_group_popover to work with pills.
settings: Show user_group_popover when pill is clicked.
Popovers on Channel/Stream settings:
Popovers on User Groups Settings:
X button hover effect:
Relevant commit for this change:
css: Show 'x' button hover styling when hovered over 'x'.
Before:
X button focuses even only by hovering over the pill and not the button itself.
Screencast.from.04-05-24.16.06.44.webm
After:
X button only focuses if the cursor is on top of it.
Screencast.from.04-05-24.14.38.21.webm
Popover closing behavior:
Relevant commit for this change:
hashchange: Fix popover not disappearing on overlay hash URL.
Before:
Clicking back button in browser doesn't hide popovers
Screencast.from.04-05-24.15.40.48.webm
After:
Screencast.from.04-05-24.15.57.19.webm
Screencast.from.04-05-24.15.57.53.webm
Impacted functions, no regression found:
toggle_user_group_info_popover()
inuser_group_popover.js
still function on mentions in messages:other user pills in group & channel setting:
Screencast.from.03-05-24.19.58.05.webm
π§βπ Concerns & Issue Encountered
user_group_pill.ts
. I've pointed out the detail hereSelf-review checklist
(variable names, code reuse, readability, etc.).
Communicate decisions, questions, and potential concerns.
Individual commits are ready for review (see commit discipline).
Completed manual review and testing of the following: