fix(events): reliable isRegistered + live attendee count#531
Merged
Conversation
…oint)
The RSVP CTA + attendee count were derived from the public/cached /fetchEvent
and the admin-gated roster: a registered user could see "Attend" + "0 / No
attendees yet" because the gated roster 403'd and isRegistered was inferred
from it.
Add GET /events/:id/registration (authed) → { isRegistered, attendeeCount }
computed live from event_attendees (+ non-upgraded guests). useEventDetail now
uses it for the CTA + count instead of inferring from the gated roster. The
attendee LIST stays attendee/creator/admin-gated (names+avatars, no PII); the
"No attendees yet" message keys off the count, so a registered user without
roster access sees the accurate count rather than "0".
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Deploying chinmaya-janata with
|
| Latest commit: |
47acdba
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://0c34a02f.project-janatha.pages.dev |
| Branch Preview URL: | https://fix-event-rsvp-registration.project-janatha.pages.dev |
…ted list The split-view panel's PeopleTab + 'People' section still read attendees.length (the admin-gated roster, often empty) → 'PEOPLE 0 / No attendees yet' even with attendees. Use event.attendees (the live count from useEventDetail) instead; show 'No attendees yet' only when the count is truly 0. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…count
Event list cards (Explore/Home) derived isRegistered + count from a per-event
gated roster fetch, so 'Going' didn't show until you opened the detail, and the
count could zero out. Add authed GET /events/registered → { eventIds } and mark
list events from that set in useDiscoverData; stop overriding the count with the
gated roster length.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…loads /getEventUsers is gated (attendee/creator/admin) but fetchEventUsers called it via apiFetch, which sends no auth token -> 401 -> empty list. So even a registered attendee saw only the count, never the names. Use authFetch. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…ssion) Guests have no account state, so the attend CTA stayed live after a guest RSVP — they could re-open the sheet and resubmit, and it wasn't obvious it worked. GuestRsvpSheet now fires onRsvped on success/already-RSVPed; the event detail, the full-page web view, and the Explore panel lock their attend button to a disabled 'You're going' for the session (reset when the panel switches events). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
On the event page, the RSVP CTA + attendee count were unreliable: a registered user could see "Attend" + "0 / No attendees yet" on refresh.
Root cause
/fetchEventis public + cached (30s) — no user context — so the client inferredisRegisteredby fetching the admin-gated roster and looking for itself. A normal attendee gets 403 on that roster → inferredisRegistered=false+ empty list. The count read the denormalizedpeople_attending, which could be stale/0.Fix
GET /events/:id/registration→{ isRegistered, attendeeCount }, computed live fromevent_attendees(+ non-upgraded guest RSVPs).useEventDetailuses it for the CTA + count instead of inferring from the gated roster.Verify (local)
tsc(both) + feed tests green.