-
Notifications
You must be signed in to change notification settings - Fork 11.6k
feat: allow normal users to see userId filter with only themselves as option #26835
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
base: main
Are you sure you want to change the base?
Conversation
… option Co-Authored-By: eunjae@cal.com <hey@eunjae.dev>
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
…User doesn't exist Co-Authored-By: eunjae@cal.com <hey@eunjae.dev>
Co-Authored-By: eunjae@cal.com <hey@eunjae.dev>
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.
No issues found across 5 files
| const { data: teams } = trpc.viewer.teams.list.useQuery(); | ||
| const { data: members } = trpc.viewer.teams.listSimpleMembers.useQuery(); |
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.
Should we disable listSimpleMembers query when canReadOthersBookings is false? We are not using 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.
that's a very good point !
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.
Good catch! I've added enabled: canReadOthersBookings to the listSimpleMembers query so it won't be called when the user doesn't have permission to read others' bookings.
…alse Co-Authored-By: eunjae@cal.com <hey@eunjae.dev>
E2E results are ready! |
What does this PR do?
Previously, the "Member" (userId) filter in the bookings list was only available to users with admin/owner permissions (
canReadOthersBookings). This PR makes the filter available to all users, but with a key difference:Why?
When we apply the "My Bookings" default filter, it applies the
userIdfilter, and before this PR, it was not possible for member users to view that filter (even though it's not much useful)Changes:
filterColumns.ts&useBookingListColumns.tsx: ChangedenableColumnFilterto always betruefor the userId columnuseFacetedUniqueValues.ts: AddedcanReadOthersBookingsparameter to conditionally return either just the current user or all team members. Returns an empty map whencurrentUserhasn't loaded yet to prevent showing all members prematurely. Also disables thelistSimpleMembersquery whencanReadOthersBookingsis false (performance optimization per reviewer feedback).BookingListContainer.tsx&BookingCalendarContainer.tsx: Pass the permission touseFacetedUniqueValuesDemo
Screenshot.2026-01-20.at.14.33.58.mp4
Mandatory Tasks (DO NOT REMOVE)
How should this be tested?
Log in as a normal team member (not admin/owner)
Navigate to the Bookings page
Click "Add Filter" - the "Member" filter should now be available
The Member filter dropdown should only show the current user as an option
Log in as an admin/owner
Navigate to the Bookings page
The "Member" filter should show all team members as options (existing behavior)
Checklist
Human Review Checklist
useFacetedUniqueValues.ts: whencanReadOthersBookings=falseandcurrentUseris undefined, an empty map is returned (prevents showing all members before user data loads)listSimpleMembersquery is disabled whencanReadOthersBookings=false(check network tab - query should not fire for normal users)Link to Devin run: https://app.devin.ai/sessions/ea27a41739644de2b65a5063e0c038d0
Requested by: @eunjae-lee