Skip to content

fix(events): reliable isRegistered + live attendee count#531

Merged
KishParikh13 merged 5 commits into
v2from
fix/event-rsvp-registration
Jun 17, 2026
Merged

fix(events): reliable isRegistered + live attendee count#531
KishParikh13 merged 5 commits into
v2from
fix/event-rsvp-registration

Conversation

@KishParikh13

Copy link
Copy Markdown
Collaborator

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

/fetchEvent is public + cached (30s) — no user context — so the client inferred isRegistered by fetching the admin-gated roster and looking for itself. A normal attendee gets 403 on that roster → inferred isRegistered=false + empty list. The count read the denormalized people_attending, which could be stale/0.

Fix

  • New authed GET /events/:id/registration{ isRegistered, attendeeCount }, computed live from event_attendees (+ non-upgraded guest RSVPs).
  • useEventDetail uses it for the CTA + count instead of inferring from the gated roster.
  • Attendee list gating is unchanged (attendee/creator/admin → names+avatars, no PII; coordinator roster → PII/CSV). The "No attendees yet" message now keys off the live count, so a registered user without roster access sees the accurate count, not "0".

Verify (local)

  • Registered user → Cancel Registration + "N person(s) on Janata"; attendee → sees the list; non-attendee → 403 (count only). tsc (both) + feed tests green.

…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>
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jun 17, 2026

Copy link
Copy Markdown

Deploying chinmaya-janata with  Cloudflare Pages  Cloudflare Pages

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

View logs

KishParikh13 and others added 4 commits June 17, 2026 11:35
…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>
@KishParikh13 KishParikh13 merged commit 1be8e80 into v2 Jun 17, 2026
3 checks passed
@KishParikh13 KishParikh13 deleted the fix/event-rsvp-registration branch June 17, 2026 19:24
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.

1 participant