Skip to content

EXTRA: Allow anonymous public form submissions - #2350

Draft
maebeale wants to merge 1 commit into
mainfrom
maebeale/hidden-questions-block-form-submission
Draft

EXTRA: Allow anonymous public form submissions#2350
maebeale wants to merge 1 commit into
mainfrom
maebeale/hidden-questions-block-form-submission

Conversation

@maebeale

Copy link
Copy Markdown
Collaborator

🤖 suggested review level: 5 Inspect 🔬 nullable FK + person-optional model change with wide nil-person blast radius

Why

Public standalone forms required name + email to build a Person, so a form meant for anonymous feedback couldn't accept a response (it errored with "needs a name and email question").

What

Per-form "Allow anonymous submissions" toggle (admin-set, in the public-link settings).

When on

  • Name/email questions stay on the form but become optional — no asterisk, no required attribute, no blank validation.
  • A blank-identity submission is recorded with no Person.
  • Respondent may still fill name/email to identify themselves (a Person is found/created as before).

Data / model

  • form_submissions.person_id is now nullable; FormSubmission belongs_to :person, optional: true.
  • Migration is not a backfill — existing rows keep their person_id.

Nil-person handling

  • Skips the submitter confirmation email (no address); team FYI still sends, showing "Anonymous respondent".
  • Admin submission index/detail show "Anonymous".
  • OtherResponses::CaptureFromSubmission no-ops (responses are person-owned).

Seams

  • Form#requires_answer? / #optional_identity_field? centralize the identity-optional rule; used by the controller validation and the field partial (new required: local, defaults to field.required so event-registration callers are unchanged).

Notes

  • Pre-existing bulk-payment flows already tolerate a nil person via current_user&.person; left untouched (out of scope).

maebeale added a commit that referenced this pull request Aug 23, 2026
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Public standalone forms required name+email to build a Person, so a form
meant for anonymous feedback couldn't accept a response. Add a per-form
"Allow anonymous submissions" toggle: when on, the identity questions stay
on the form but become optional, and a blank-identity submission is recorded
with no Person.

- form_submissions.person_id is now nullable; FormSubmission#person optional
- PublicFormSubmission records a person-less submission (and skips the
  submitter confirmation email) when the form allows anonymous
- identity questions render optional and skip required validation via
  Form#requires_answer?/#optional_identity_field?
- admin submission views and the team FYI email handle a nil person

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@maebeale
maebeale force-pushed the maebeale/hidden-questions-block-form-submission branch from 103c63a to 3b0d5d4 Compare August 23, 2026 21:27
@maebeale maebeale changed the title Allow anonymous public form submissions EXTRA: Allow anonymous public form submissions Aug 24, 2026
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