Skip to content

Let organizers make the participant email optional #378

Description

@richshaw

Part of #347, step 3 of 3. Do #375 and #377 first.

What we're building

Each signup gets a choice in the organizer Settings tab: Ask for an email address: Required / Optional. Required stays the default, so existing signups behave as they do today.

On a signup set to Optional:

  • The Email box stays on the sign-up form, labelled "Email (optional)", with the help text "Optional. If you give one, we'll email you your link to change or cancel."
  • Anyone who gives an email gets the confirmation and reminder emails as they do now.
  • Anyone who leaves it blank gets no emails. The success screen tells them plainly: "We won't email you this link. Save it now: it's the only way to change or cancel." It also mentions that Add to calendar saves the link, and offers "Copy link".

Decided:

  • The setting lives in the Settings tab and defaults to Required.
  • If an organizer switches back to Required, people who signed up without an email keep their spots and can still change or move them. Only new sign-ups are asked.

Plan

Data

  • Write a migration with pnpm db:generate that drops NOT NULL on participants.email and participants.email_lower. Add a CHECK that the two are either both null or both set.
  • Keep the unique index on (signup_id, email_lower). Postgres treats NULLs as distinct, so many blank-email participants can share a signup. Don't add .nullsNotDistinct().
  • Use the existing requireEmail setting (src/schemas/signups.ts, default true). No new column.

Signing up

  • src/schemas/commitments.ts: treat an empty or missing email as no email.
  • commitToSlot: when the signup requires an email and none was given, return invalid_input with field: 'email' and a message written for participants ("Email is required for this signup"). The signup row is already read there, so the check adds no query.
  • With no email, always create a new participant row and skip the email lookup.
  • Moving to another slot: updateOwnCommitment moves a person by calling commitToSlot with current.participantEmail (around line 433 of src/services/commitments.ts). With a null email, that would create a new participant on every move. After a switch back to Required, it would refuse the move. So give commitToSlot a way to commit a known participant, for example a participantId option or a split-out internal function. A move should never look the person up by email and never re-check requireEmail.
  • The per-email rate limit already skips a blank email (the route only charges it for a string containing @). Update the comment only.

Sign-up form

  • commit-dialog.tsx: pass requireEmail in through SignupViewProps.signup. page.tsx already has sig.settings, so this adds no query.
  • When the email is optional, drop the required attribute and change the label and help text. Add the no-email success screen described above.
  • The Build preview should show the same label.
  • The saved name and email that prefill the form (in localStorage) already handle an empty email.

Emails

  • src/email/notify.ts: return early when the participant has no email, before the alreadySent query.
  • src/jobs/reminders.ts: add isNotNull(participants.email) to selectDueReminders. sendReminderJob checks again before sending.

Participant pages

  • Edit page (src/app/s/[slug]/c/[id]/page.tsx): leave out "(email)" when there isn't one.
  • gone-message.ts: change the advice to "If you got a confirmation email, try its link again, or contact the organizer."
  • unsubscribe/page.tsx: the "Reminders turned off" text also points at the confirmation email, so reword it the same way.
  • OptOutTarget.participantEmail becomes nullable. The stop-reminders page is only reached from a reminder email, so this is a type change only.

Organizer views

  • Settings tab: add a "Sign-up form" section. Build it as a plain server-rendered form using the existing submit button, with no new client component. /app/signups/[id]/settings is budgeted at 125 KB.
  • Settings help text: "Someone who leaves it blank gets no emails and sees their link only once. You can remove them from Responses if they lose it."
  • Responses tab: show "—" when there is no email. The CSV export already writes an empty cell.

AI connector

  • Take requireEmail out of UNREAD_SETTINGS (src/mcp/tools/signups-read.ts), so update_signup can set it and get_signup shows it. Update the comment there.
  • Rewrite the sentence in the update_signup description (signups-write.ts) that says email can't be made optional. Keep the description descriptive rather than an instruction; registry.test.ts checks this.
  • Update the tests that pin today's behaviour: signups-write.test.ts, tools.db.test.ts and read.test.ts.
  • No MCP tool returns participants, so nothing else in the connector changes.

Public wording (same PR, per CLAUDE.md)

  • Privacy page:
    • the "Email address. This is required…" line
    • the "without re-entering your email" line
    • the email delivery section
  • Cookies page: the os_commit row.
  • Update both pages' "Last updated" dates.
  • Help article create-and-publish-a-signup:
    • update "They type their name and email" and "Each person gets an email"
    • add a short section on the new setting
    • add the new on-screen names to its .ui.ts list and walkthrough
    • re-run pnpm help:screenshots (see the help-pages skill)

Tests

  • Unit: the input schema with a blank, a missing and a valid email.
  • DB:
    • signing up without an email on an Optional signup
    • two blank-email people on one signup
    • Required still refuses a blank email
    • a no-email participant who moves slots stays the same participant, including after a switch back to Required
    • reminders and confirmations skip no-email participants
  • Query budget: the existing POST /api/slots/[id]/commitments entry won't change, because it signs up with an email. Add a second entry for the no-email path.
  • e2e: seed a signup with requireEmail: false in tests/e2e/helpers/seed.ts and cover signing up without an email. public-commit.spec.ts still finds the box by its label, because "Email (optional)" contains "Email".

Known gaps (accepted for now)

  • With no email there is nothing to recognise a repeat sign-up by. If someone without an email hits a network error and presses Confirm again, they can end up signed up twice. Double-clicks are already blocked, and the organizer can remove the extra sign-up (Organizers can remove one person from a slot #377). A check based on the browser cookie could come later. Note this in the PR.
  • Someone who signs up once with an email and once without shows as two people on the Responses tab.

Out of scope

  • Adding an email later from the edit page to start getting reminders. That would be a new way to trigger outgoing mail, so it needs its own abuse review.
  • A "never ask for email" option.

Done when

  • An organizer can set email to Optional in Settings. Required is the default, and existing signups behave as before.
  • On an Optional signup:
    • someone can sign up with the email left blank, sees the save-your-link warning, and gets no emails
    • someone who gives an email gets both emails as before
  • pnpm lint && pnpm typecheck && pnpm knip && pnpm test, pnpm test:db, pnpm budgets and the e2e suite all pass.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions