Skip to content

Persist event registration slugs in session#1365

Draft
maebeale wants to merge 1 commit intomainfrom
maebeale/event-slug-persistence
Draft

Persist event registration slugs in session#1365
maebeale wants to merge 1 commit intomainfrom
maebeale/event-slug-persistence

Conversation

@maebeale
Copy link
Collaborator

@maebeale maebeale commented Mar 8, 2026

What is the goal of this PR and why is this important?

  • Public (non-authenticated) users who register for events lose the ?reg= query param when navigating away from the event show page
  • This causes the "View Registration" button to disappear on the events index and on revisits to the event show page
  • Logged-in users aren't affected since their registration is looked up via current_user.person

How did you approach the change?

  • Added EventRegistrationSession concern that stores registration slugs in session[:event_reg_slugs] as a { event_id => slug } hash
  • Slugs are stored on registration create, ticket view, and reactivation; cleared on cancellation
  • _registration_section.html.erb and _card.html.erb fall back to session when params[:reg] is absent
  • "Back to Events" navigation links pass ?reg= as belt-and-suspenders (works even without a session, e.g. shared URLs)
  • Stale slugs are handled gracefully — find_by returns nil → active? is false → user sees "Register" instead

UI Testing Checklist

  • Register as public user → visit ticket → go to events index → "View registration" button appears on card
  • Click into event show from index → "View Registration" button still visible
  • Cancel registration → "View Registration" disappears from both index and show
  • Reactivate registration → "View Registration" reappears
  • Logged-in user registration flow still works as before

Anything else to add?

  • Session size is negligible (~30 bytes per registration)
  • No N+1 concern on index — session lookup is in-memory, DB query only fires for events with a stored slug

🤖 Generated with Claude Code

Public (non-authenticated) users who register for events lose their
?reg= query param when navigating away from the event show page,
causing the "View Registration" button to disappear. This stores
registration slugs in the Rails session so the button persists
across navigation to the events index and back.

- Add EventRegistrationSession concern for session slug management
- Store slugs on registration create, show, reactivate; clear on cancel
- Fall back to session in _registration_section and _card partials
- Pass ?reg= on "Back to Events" navigation links as belt-and-suspenders
- Add request spec coverage for session storage/clearing

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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