Skip to content

Conversation

@eunjae-lee
Copy link
Contributor

@eunjae-lee eunjae-lee commented Jan 14, 2026

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:

  • Normal users: See only themselves as the single filter option
  • Admin/Owner users: See all team members as filter options (existing behavior)

Why?

When we apply the "My Bookings" default filter, it applies the userId filter, 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: Changed enableColumnFilter to always be true for the userId column
  • useFacetedUniqueValues.ts: Added canReadOthersBookings parameter to conditionally return either just the current user or all team members. Returns an empty map when currentUser hasn't loaded yet to prevent showing all members prematurely. Also disables the listSimpleMembers query when canReadOthersBookings is false (performance optimization per reviewer feedback).
  • BookingListContainer.tsx & BookingCalendarContainer.tsx: Pass the permission to useFacetedUniqueValues

Demo

Screenshot.2026-01-20.at.14.33.58.mp4

Mandatory Tasks (DO NOT REMOVE)

  • I have self-reviewed the code (A decent size PR without self-review might be rejected).
  • I have updated the developer docs in /docs if this PR makes changes that would require a documentation change. N/A - no docs changes needed
  • I confirm automated tests are in place that prove my fix is effective or that my feature works.

How should this be tested?

  1. Log in as a normal team member (not admin/owner)

  2. Navigate to the Bookings page

  3. Click "Add Filter" - the "Member" filter should now be available

  4. The Member filter dropdown should only show the current user as an option

  5. Log in as an admin/owner

  6. Navigate to the Bookings page

  7. The "Member" filter should show all team members as options (existing behavior)

Checklist

  • My code follows the style guidelines of this project
  • I have commented my code, particularly in hard-to-understand areas
  • I have checked if my changes generate no new warnings

Human Review Checklist

  • Verify edge case handling in useFacetedUniqueValues.ts: when canReadOthersBookings=false and currentUser is undefined, an empty map is returned (prevents showing all members before user data loads)
  • Verify listSimpleMembers query is disabled when canReadOthersBookings=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

… option

Co-Authored-By: eunjae@cal.com <hey@eunjae.dev>
@devin-ai-integration
Copy link
Contributor

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR that start with 'DevinAI' or '@devin'.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

devin-ai-integration bot and others added 2 commits January 20, 2026 11:02
…User doesn't exist

Co-Authored-By: eunjae@cal.com <hey@eunjae.dev>
Co-Authored-By: eunjae@cal.com <hey@eunjae.dev>
@eunjae-lee eunjae-lee marked this pull request as ready for review January 20, 2026 13:39
@graphite-app graphite-app bot added the core area: core, team members only label Jan 20, 2026
@graphite-app graphite-app bot requested a review from a team January 20, 2026 13:39
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a 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

Comment on lines 20 to 21
const { data: teams } = trpc.viewer.teams.list.useQuery();
const { data: members } = trpc.viewer.teams.listSimpleMembers.useQuery();
Copy link
Contributor

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

Copy link
Contributor Author

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 !

Copy link
Contributor

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>
@Udit-takkar Udit-takkar enabled auto-merge (squash) January 22, 2026 08:14
@github-actions
Copy link
Contributor

github-actions bot commented Jan 22, 2026

E2E results are ready!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

consumer core area: core, team members only ready-for-e2e size/L

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants