Skip to content

Allow registered participants to claim spots for guests#128

Merged
michaelchu merged 3 commits intomainfrom
allow-participants-to-claim-spots
Mar 9, 2026
Merged

Allow registered participants to claim spots for guests#128
michaelchu merged 3 commits intomainfrom
allow-participants-to-claim-spots

Conversation

@michaelchu
Copy link
Copy Markdown
Owner

Summary

  • Extend the claim-spots feature so any registered participant (not just the organizer) can claim spots for guests they're bringing
  • Add isRegistered param to canUserClaimSpot() — organizers OR registered participants can now claim
  • New RLS policy permits INSERT when user is either the event organizer or an existing participant
  • Feature remains gated behind the guest_registration feature flag

Test plan

  • Unit tests for canUserClaimSpot cover both organizer and registered-participant paths
  • Integration tests verify Claim button visibility for: organizer, registered non-organizer, unregistered user, unauthenticated user
  • All 460 tests pass, build clean
  • Manual: join an event as a non-organizer, verify Claim button on empty slots when guest_registration is enabled
  • Manual: verify organizer can still claim on a newly created event (before joining)

🤖 Generated with Claude Code

Extend the claim-spots feature so any authenticated user who has joined
an event can claim spots for others, not just the organizer. Adds an
RLS policy that permits INSERT when the user is either the event
organizer or an existing participant. The feature remains gated behind
the guest_registration feature flag.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR extends the claim-spots feature to allow any registered event participant (not just the event organizer) to claim empty spots for guests they're bringing. The feature remains gated behind the guest_registration feature flag.

Changes:

  • Updated the canUserClaimSpot() utility to accept a new isRegistered parameter, allowing either organizers or registered participants to claim spots
  • Added a new Supabase RLS migration that replaces the organizer-only INSERT policy with one that permits inserts from any registered participant of the event
  • Updated unit and integration tests to cover the new registered-participant claiming path

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
supabase/migrations/20260310000000_allow_participants_to_claim_spots.sql New migration that drops the organizer-only claim policy and creates a broader policy allowing registered participants to claim spots
src/lib/utils.ts Added isRegistered parameter to canUserClaimSpot() with (isOrganizer || isRegistered) logic
src/pages/EventDetailPage.tsx Passes isRegistered: !!userRegistration to canUserClaimSpot() call
src/pages/__tests__/canUserClaimSpot.test.ts Updated unit tests with new base args and test cases for registered vs. unregistered users
src/pages/__tests__/EventDetailPage.test.tsx Added integration test for non-organizer registered user seeing the Claim button; updated test name for unregistered user case

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Copy Markdown
Owner Author

@michaelchu michaelchu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code review

No issues found. Checked for bugs and CLAUDE.md compliance.

🤖 Generated with Claude Code

Enable the guest_registration feature flag per-user in E2E tests using
the existing enableFeatureFlagForUser helper. Tests cover both organizer
and registered non-organizer claiming spots for guests.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@michaelchu michaelchu temporarily deployed to allow-participants-to-claim-spots - Roster PR #128 March 9, 2026 19:20 — with Render Destroyed
@michaelchu michaelchu merged commit a4f7df4 into main Mar 9, 2026
2 checks passed
@michaelchu michaelchu deleted the allow-participants-to-claim-spots branch March 9, 2026 19:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants