Skip to content

Gate public event forms on the public-registration flag - #2049

Draft
maebeale wants to merge 7 commits into
mainfrom
maebeale/public-registration-access-gate
Draft

Gate public event forms on the public-registration flag#2049
maebeale wants to merge 7 commits into
mainfrom
maebeale/public-registration-access-gate

Conversation

@maebeale

@maebeale maebeale commented Aug 2, 2026

Copy link
Copy Markdown
Collaborator

🤖 suggested review level: 5 Inspect 🔬 behavior change — anonymous access to public forms now depends on the public-registration flag

⚠️ Stacked on #2046 (Forms dropdown). Base is maebeale/forms-dropdown-dashboard; review/merge that first, then this rebases onto main.

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

  • Make the public-registration flag actually gate access to the public forms. Today the register button only advertises registration to anonymous visitors when the flag is on, but the form URLs are reachable directly regardless — this closes that gap.
  • Anonymous visitors may reach the registration, scholarship, and bulk-payment forms only when public registration is enabled; signed-in users and admins always may (matches the existing register-button logic, so signed-in registration on flag-off events is unaffected).

How did you approach the change?

  • Events::PublicRegistrationPolicy#new?/create?admin? || public_registration_enabled? || authenticated? (covers registration + scholarship — same controller; authorize! @event, with: … so the policy sees the event).
  • BulkPaymentFormSubmissionsController gets an equivalent before_action.
  • Forms dropdown: hide the registration link when one-click is on and public registration is off (nobody reaches the form page then).
  • Adds a :publicly_registerable factory trait; existing anonymous specs use it, plus new access-control + one-click specs.

Anything else to add?

  • Behavior change: a direct URL to these forms on a flag-off event now redirects an anonymous visitor (to root for registration/scholarship, to the event for bulk payment).

maebeale and others added 7 commits August 2, 2026 11:05
Consolidate the dashboard's inline quick-links row into a top-right
Forms dropdown (below the sub-nav), reusing the parameterized
form_actions_menu partial the registrants page already uses. Its
"Manage forms" item deep-links to the Edit-event form-settings section
so admins have one obvious path to configure forms.

Also clarify the registration display toggle copy: "Show event details
at top of registration form".

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Both pages share _form_actions_menu, so make its defaults the shared
labels (Forms button, Edit form settings) and rename the public-form
items to Registration form / Scholarship form. Only sample_return_to
differs per page so each eyebrow returns to its origin.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
… registration

Scholarship and bulk payment links only make sense with a fee, so show
them only when the event has a cost. The registration link shows only
when a registration form is selected, and reads 'Public registration
form' when public registration is enabled (the flag reflects public
advertising, not access — so it doesn't affect the other links).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Gate access to the public registration, scholarship, and bulk-payment
form pages on the event's public_registration_enabled flag: anonymous
visitors need the flag on; signed-in users and admins always may. This
mirrors the register button, which already only advertises registration
to anonymous visitors when the flag is on — closing the direct-URL gap.

Registration/scholarship go through Events::PublicRegistrationPolicy
(new?/create? = admin? || public_registration_enabled? || authenticated?);
bulk payment uses a controller before_action with the same rule.

Forms dropdown: hide the registration link when one-click is on and
public registration is off (nobody hits the form page then); prefix all
three links with 'Public' when public registration is enabled.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Move the public-form access-control changes (policy/controller gating and
the one-click-based link hiding) to a separate PR. This PR keeps just the
Forms dropdown: the links, cost-gating of scholarship/bulk payment, and
the 'Public …' label prefix keyed on public_registration_enabled? as a
display marker (its meaning before the permissioning work).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Anonymous visitors may only reach the public registration, scholarship,
and bulk-payment form pages when the event's public_registration_enabled
flag is on; signed-in users and admins always may. Mirrors the register
button, which already only advertises registration to anonymous visitors
when the flag is on — closing the direct-URL gap.

- Events::PublicRegistrationPolicy#new?/create? =
  admin? || public_registration_enabled? || authenticated? (covers the
  registration + scholarship pages, same controller).
- BulkPaymentFormSubmissionsController gets an equivalent before_action.
- Forms dropdown: hide the registration link when one-click is on and
  public registration is off (nobody reaches the form page then).
- Adds a :publicly_registerable factory trait; access + one-click specs.

Stacked on #2046 (Forms dropdown).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Base automatically changed from maebeale/forms-dropdown-dashboard to main August 2, 2026 17:18
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