Skip to content

Invite-only forms by role + invite email (#844) - #895

Merged
mbhewitt merged 2 commits into
mainfrom
feat/form-invites
Nov 29, 2026
Merged

mbhewitt merged 2 commits into
mainfrom
feat/form-invites

Conversation

@mbhewitt

Copy link
Copy Markdown
Owner

Item 10, invite-only forms. Refs #844, #845, #846. Mew agreed on 2026-11-29 that inviting someone means giving them a role, the same idea as the #848 exclusions.

Migration 033

  • Adds op_forms.invite_role_id and op_forms.hidden_role_id. NULL means no limit.

Behavior

  • Who sees a form: a form with an invite role is shown only to people who hold that role. This applies to the checklist list, the form page and saving answers; everyone else gets a 404.
  • Hidden role: the hidden role (e.g. NoCamping) always wins, even for someone who was invited.
  • How to invite: use any existing role tool:
    • on the VIS answers page, filter, tick people, then Add role;
    • a volunteer's page or the role's page;
    • Create Account first for someone who has never signed in.
  • Editor: gets "Only for role" and "Hidden from role" pickers.
  • Invite email:
    • The text is email.form-invite, editable on /emails like the shift emails. Its fields are {{name}} {{form}} {{opens}} {{link}}.
    • Sent once per person per form, when the form is published (not closed) and the person holds the invite role, whichever happens last. Hooks: saving a form, and granting a role through /api/roles/[roleId]/volunteers.
    • The email queue (category form-invite:<id>) records who already got one. DoNotContact and unsubscribed people are skipped by the queue.

Tests

  • 39-forms gains an invite-only test:
    • not invited: the form isn't listed and returns 404;
    • after the invite role is granted: the form is listed and exactly one email is queued; granting again sends no second email;
    • after the hidden role is added: the form is gone again.
  • Locally, 39, 38 and 03 pass.

🤖 Generated with Claude Code

mbhewitt and others added 2 commits November 29, 2026 01:46
Mew 2026-11-29: inviting = giving a role (like the #848 exclusions).
- migration 033: op_forms.invite_role_id / hidden_role_id
- only invite-role holders see the form (list, page, saving); the hidden
  role (e.g. NoCamping) always wins
- "Only for role" / "Hidden from role" on the form editor
- invite email (editable on /emails, email.form-invite), once per person
  per form, sent when the form is published or the role is granted,
  whichever is later; DoNotContact/unsubscribed skipped by the queue

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@mbhewitt
mbhewitt merged commit e05232d into main Nov 29, 2026
1 check passed
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