Skip to content

Keep View registration button lit for public users via reg param#1365

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

Keep View registration button lit for public users via reg param#1365
maebeale wants to merge 1 commit into
mainfrom
maebeale/event-slug-persistence

Conversation

@maebeale

@maebeale maebeale commented Mar 8, 2026

Copy link
Copy Markdown
Collaborator

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

  • Public (non-authenticated) users who register for events lose the "View registration" button as soon as they navigate away
  • They have no logged-in identity to look the registration up by, so once the ?reg= slug drops off the URL the button disappears on the events index and on event pages
  • This keeps the button lit for the current browsing session, including for someone who registers for 2–3 events in a row

How did you approach the change?

  • Threads the registration slug through the URL as a ?reg= param instead of persisting anything server-side
  • Multiple slugs are packed into one param, period-delimited (?reg=slugA.slugB) — a period never occurs in a urlsafe_base64 slug, so the URL stays clean and collision-free
  • EventsHelper parses the param, matches a registration per event, and merges a new slug in after registering so earlier events stay lit
  • The param is forwarded across the "← Events" / card / register links and the ticket page, and survives the Stripe checkout round-trip for paid events

Why URL param instead of session?

  • Privacy on shared devices — nothing is stored server-side, so the next person on a library/public computer never sees a prior visitor's "View registration" button (a session would have leaked it until expiry)
  • Simplicity — no session state machine to store/clear/expire; the URL is the single source of truth and is naturally ephemeral (close the tab, it's gone)

Trade-offs

  • The button only persists along links that forward the param — a bookmark, the Home link, or a return visit tomorrow won't show it. This is intended for a single browsing session, and is arguably correct for anonymous users
  • Cancelling/reactivating doesn't re-thread the full param set (rare action); the ticket page still shows the correct state

UI Testing Checklist

  • Register as public user → visit ticket → "← Events" → "View registration" appears on that event's card
  • Click into the event from the index → button still visible
  • Register for a second event in the same session → both cards show "View registration" on the index
  • Paid event: register → pay via Stripe → return to ticket → button persists
  • Cancelled registration → card shows "Register again", not "View registration"
  • Logged-in user registration flow still works as before

🤖 Generated with Claude Code

@maebeale maebeale force-pushed the maebeale/event-slug-persistence branch from 1510833 to cca0f79 Compare April 5, 2026 20:31
@github-actions

github-actions Bot commented May 6, 2026

Copy link
Copy Markdown

This pull request has been inactive for 30 days. Please update it or let us know if it is still relevant.

1 similar comment
@github-actions

github-actions Bot commented Jun 5, 2026

Copy link
Copy Markdown

This pull request has been inactive for 30 days. Please update it or let us know if it is still relevant.

@maebeale maebeale force-pushed the maebeale/event-slug-persistence branch from cca0f79 to 22240eb Compare July 15, 2026 11:47
Copilot AI review requested due to automatic review settings July 15, 2026 11:47

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Public (non-authenticated) users who register for events lose the
'View registration' button when they navigate away, because they have no
logged-in identity to look the registration up by. This threads the
registration slug through the URL as a '?reg=' param so the button
persists across the events index and event pages for the current
browsing session.

- Slugs are packed into a single reg param, period-delimited, so one
  session can carry 2-3 registrations (period never occurs in a
  urlsafe_base64 slug, keeping the URL clean and collision-free)
- EventsHelper parses the param, matches registrations per event, and
  merges a new slug in after registering so earlier events stay lit
- The param is forwarded across nav/register links and the ticket page,
  and survives the Stripe checkout round-trip for paid events
- Purely URL-based: nothing persists server-side, so a shared computer
  never leaks a prior visitor's registration
- Request spec coverage for single- and multi-slug display and merging

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@maebeale maebeale force-pushed the maebeale/event-slug-persistence branch from 22240eb to 97b37ce Compare July 15, 2026 12:36
Copilot AI review requested due to automatic review settings July 15, 2026 12:36

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@maebeale maebeale changed the title Persist event registration slugs in session Keep View registration button lit for public users via reg param Jul 15, 2026
# (logged-out) users keep the "View registration" button lit across several
# events in one session. A period is used because it never appears in a
# urlsafe_base64 slug and stays unescaped in a URL, keeping it human-readable.
REG_PARAM_DELIMITER = "."

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

🤖 From Claude: Period is the delimiter because slugs are urlsafe_base64 (alphabet includes - and _) — a hyphen delimiter could collide with a slug that contains one. . never appears in base64url and stays unescaped in URLs.

<% content_for(:page_bg_class, "public") %>
<div class="max-w-3xl mx-auto flex flex-wrap items-center gap-2 px-4 pt-4">
<%= link_to event_path(@event_registration.event, reg: @event_registration.slug), class: "inline-flex items-center gap-1.5 text-sm text-gray-500 hover:text-gray-700 px-2 py-1" do %>
<%= link_to event_path(@event_registration.event, reg: reg_param_with(@event_registration.slug)), class: "inline-flex items-center gap-1.5 text-sm text-gray-500 hover:text-gray-700 px-2 py-1" do %>

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

🤖 From Claude: This is the one place a slug gets added to the set — after any registration the visitor lands here, so merging this ticket's slug into the inbound ?reg= param is what lets a second/third event stay lit alongside earlier ones.

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