Repository navigation
feat(events): manager registration notifications + per-event routing - #594
Merged
Merged
Conversation
Add getFrequencyOptions + REGISTRATION_OVERRIDE_FREQUENCY_OPTIONS + DEFAULT_REGISTRATION_FREQUENCY, sourced from NOTIFICATION_TYPES so the per-event registration-notification fields can't drift from the shared single source of truth. The override options omit the not-yet-delivered summary cadences. Refs #588 Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
The verification email's local DetailRow (plus its label/value column styles) becomes a shared EmailLayout export so the registration notification can reuse the same fact-table row. EventVerificationEmail now imports it; its rendered output is unchanged. Refs #588 Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Adds a shared row on the Registration tab: registrationNotificationEmail (email, shown for sahaj-atlas events) routes registration updates to an address other than the manager, and registrationNotificationFrequency (shown only when an override is set) picks the cadence. Options derive from the shared NOTIFICATION_TYPES config; summaries are omitted until the digest run exists. Refs #588 Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Adds registration_notification_email + registration_notification_frequency to events and _events_v (drafts enabled), plus the frequency enum. Fully reversible. Refs #588 Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Add a pure resolver that returns the registration-notification target, display name, channel, and frequency. An override address replaces the manager and forces the email channel; otherwise the manager is reached via pickChannel (now parameterised by notification key) at the event_registration cadence. The frequency is returned, not acted on, so the immediate send and the future digest run share this seam. Refs #588 Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
New EventRegistrationEmail (EmailLayout + BrandButton + styles + DetailRow, Sahaj Atlas brand) shows the event, registrant, and session with a link to the event in the admin. sendRegistrationNotification renders + sends it; a non-email channel is stub-logged like the verification reminders, and a real send failure throws so the 201 policy stays at the call site. Refs #588 Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
registerForEvent now resolves the notification recipient after the registration is created and, when the cadence is Immediate, sends the manager (or override address) a notification. Best-effort and independent of the registrant confirmation: a failure is logged and the response stays 201. Adds int coverage for immediate send, override routing (manager gets no copy), summary/Never no-send, an unresolvable manager, and a throwing send. (Also tidies import order in the two new modules.) Refs #588 Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Add the manager registration-notice template to the template table, note DetailRow is now a shared EmailLayout export, and record the informational manager-mail variant alongside the alert/itinerary archetypes. Refs #588 Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
railway-app
Bot
temporarily deployed
to
sahajcloud / SahajCloud-pr-594
July 20, 2026 15:16
Destroyed
Adds scripts/preview-registration-notification-emails.ts — drives the real sendRegistrationNotification() path through an Ethereal transport to render EventRegistrationEmail in its meaningful states (named manager, override address with neutral greeting, no session, long title). Documents it in the scripts + email rules. Refs #588 Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
|
🚅 Deployed to the SahajCloud-pr-594 environment in sahajcloud
|
Placeholder ("Event Manager") + a description that spells out the field
redirects new-registration updates away from the manager.
Refs #588
Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Three updates to the manager registration notification: - Rename the "Session" row to "Start date". - Forward the registrant's answers to the event's registration questions, labelled from EVENT_REGISTRATION_QUESTIONS (buildRegistrationAnswers) and rendered as a "Registration answers" section. - Add a primary "Reply to <registrant>" mailto CTA (View event demoted to secondary). Adds buildRegistrationAnswers + its unit test, extends the render + int coverage, and updates the Ethereal preview script. Refs #588 Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
- Put Reply and View event side by side via a new shared BrandButtonRow (EmailLayout), factoring the variant style out of BrandButton. - Reply is a mailto pre-filled with a quoted recap of the registration (event, start date, and the forwarded Q&A) so the seeker sees the context — a mailto can't set In-Reply-To, so it can't thread into the confirmation email; the quote stands in for the chain. Exports buildReplyBody + a unit test. - Clarify the stale `questions`-key comments: answers are keyed by the event's EVENT_REGISTRATION_QUESTIONS names, which buildRegistrationAnswers resolves to labels. Refs #588 Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Payload embeds admin.description as JSDoc on the generated types; picks up the registrationNotificationEmail copy tweak and the clarified Registrations.questions description. Refs #588 Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Add RegistrationQuestions (Partial<Record<question name, string>>) and a pure-JS validateRegistrationQuestions, both derived from EVENT_REGISTRATION_QUESTIONS, and wire the validator onto the Registrations.questions field. A bad payload (unknown key or non-string answer) throws a ValidationError, which the register endpoint surfaces as a 400. Pure-JS validate rather than jsonSchema — Payload compiles the latter to an Ajv new Function() validator that throws under Cloudflare's codegen ban (see translationsField). Refs #588 Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
- Add a shared EmailLayout.SectionHeading (uppercase section label) and use it in both the registration and verification emails; the registration email gains an "Event details" heading above its table, so both sections now have consistent headers and top margin. - BrandButtonRow centers its buttons together (inline in a centered cell) instead of spreading them across the width. - Redesign the Reply mailto's quoted recap: one block per topic (event facts, then each Q&A) separated by blank quoted lines, question above its answer. Refs #588 Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Move EVENT_REGISTRATION_QUESTIONS + RegistrationQuestions + RegistrationAnswer + validateRegistrationQuestions + buildRegistrationAnswers out of Events/eventOptions.ts into src/lib/registrations/questions.ts, so Registrations no longer cross-imports from the Events collection (the project-structure rule's cross-owner-import violation). RegistrationAnswer is now defined once (the email imports it from src/lib). Also simplify buildRegistrationAnswers to a two-loop form (drops the seen-set, the push helper, and the QUESTION_LABELS map). Refs #588 Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Refs #588 Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
railway-app
Bot
temporarily deployed
to
sahajcloud / SahajCloud-pr-594
July 20, 2026 18:38
Destroyed
This was referenced Jul 20, 2026
Ardnived
added a commit
to sydevs/SahajAtlasWeb
that referenced
this pull request
Jul 20, 2026
…ON_QUESTIONS (#63) * chore(types): resync payload-types from SahajCloud main Regenerated via `pnpm types:cms`. SahajCloud main has advanced broadly since the last sync — this refreshes ~20 interfaces (locale enums now include en-AU/ hu/nl and pt-BR casing, Region.eventDefaults dropped, User/Frame/Form/Client shape updates, and the Registration.questions doc comment now names the EVENT_REGISTRATION_QUESTIONS keys). Typechecks cleanly; we don't reference any of the removed/renamed fields. Done here so #60 can derive the registration-question key set from the freshly synced Event['registrationQuestions']. Refs #60 Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> * refactor(registration): constrain questions payload to the CMS question keys The registration `questions` payload was typed loosely as `z.record(z.string())`. SahajCloud now validates it (PR sydevs/SahajCloud#594): keys must be EVENT_REGISTRATION_QUESTIONS members and values strings, else the register endpoint 400s. Align the client to that contract before it ships. - Derive `RegistrationQuestionName` from the synced `Event['registrationQuestions']` CMS type (not a hardcoded list). A `satisfies Record<RegistrationQuestionName, …>` on `RegistrationQuestionsSchema` fails the build if a `types:cms` resync adds or drops a question, and `REGISTRATION_QUESTION_NAMES` / `RegistrationQuestionNameSchema` derive from that schema's shape — one guarded source of truth. - Tighten `RegistrationSchema.questions` to `z.record(RegistrationQuestionNameSchema, z.string())`, which rejects unknown keys / non-string values client-side, mirroring the server. - Narrow `enabledQuestions()` and the RegistrationForm `questions` prop from `string[]` to `RegistrationQuestionName[]` so `register(\`questions.<name>\`)` stays type-checked against the tightened schema (behaviour unchanged — same ordered subset). - Cover the contract in the type tests: valid subset, empty-string answer (an enabled-but-unanswered question), omitted questions, unknown key, non-string value. Closes #60 Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> * test(types): drop tautological question-names assertion Per the /simplify pass: `REGISTRATION_QUESTION_NAMES` *is* `Object.keys( RegistrationQuestionsSchema.shape)`, so asserting them equal compared a value to itself and could never fail. The concrete-list assertion already pins the key set + order. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> --------- Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]>
This was referenced Jul 20, 2026
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Immediatecadence, best-effort so a send failure never breaks the201. It forwards the registrant's answers to the event's registration questions and offers a Reply CTA (amailto:pre-filled with a quoted recap) next to View event.resolveRegistrationRecipient(the recipient+cadence seam the scheduled-digest follow-up reuses), and types + validates the registrationquestions(keys ⊆EVENT_REGISTRATION_QUESTIONS, string answers → a400on a bad payload).EmailLayout.SectionHeading+BrandButtonRow(+ the earlierDetailRow) — reused by both the registration and verification templates for a consistent look.Changes of note
src/lib/registrations/questions.ts(new) — the shared registration-questions contract (EVENT_REGISTRATION_QUESTIONS,RegistrationQuestions,RegistrationAnswer,validateRegistrationQuestions,buildRegistrationAnswers), soRegistrationsno longer cross-imports from theEventscollection.src/collections/Events/endpoints/registerForEvent.ts— resolves the recipient afterpayload.createand sends the manager notice onImmediate(its own best-effort try/catch, independent of the registrant confirmation).src/lib/notifications/—resolveRegistrationRecipient+sendRegistrationNotification;pickChannelparameterised by notification key (verification path unchanged).src/emails/—EventRegistrationEmail+ sharedSectionHeading/BrandButtonRowinEmailLayout; verification email repointed at the shared primitives.scripts/preview-registration-notification-emails.ts— Ethereal preview for the notice, all states.Migration
src/migrations/20260720_141351_event_registration_notification_fields.ts— addsregistration_notification_email+registration_notification_frequencytoeventsand_events_v(drafts) + the frequency enum. No data transformed. Reversible.§4 summary-frequency gap (decision)
The override select omits
Daily Summary/Weekly Summaryuntil the scheduled-digest follow-up ships, so every selectable override cadence acts deterministically today (Immediatesends now,Nevernever sends) — no silent gap. The resolver still returns all four cadences; a manager's own summary preference is stored but sends nothing here (documented known gap), to be picked up by the digest run. Not a silent fall-back to immediate.Test results
buildRegistrationAnswers/validateRegistrationQuestions, andEventRegistrationEmail+buildReplyBodyrender.event-registration.int.spec.ts31 passed — immediate send, override routing (manager gets no copy), override-blank → manager, summary/Neverno-send, unresolvable manager, throwing send keeps 201, answers forwarded, unknown-key → 400./simplify(4 agents → lifted the questions domain intosrc/lib),/code-review(high, correctness clean),/security-review(no issues — mailto injection-safe, validator blocks prototype keys).Notes for reviewer
questions-key enforcement is strict —Registrations.questionsnow rejects (400) any key not inEVENT_REGISTRATION_QUESTIONS. The Atlas widget already submits those keys (traced in sydevs/SahajAtlasWeb#60, filed to confirm before merge); flagging in case the live widget is out of sync.SectionHeading); its notification logic is untouched.vi.spyOn(payload, 'sendEmail')(the pattern this file already uses — a secondcreateTestEnvironment*per file is disallowed); "manager with no email" is unreachable via the real endpoint (auth requires one), so it's covered by the resolver unit test, with the endpoint's no-recipient → no-send path int-tested via a failed manager lookup.jsonSchemawas avoided for thequestionsvalidation — Payload compiles it to an Ajvnew Function()validator that throws under Cloudflare's codegen ban (seetranslationsField); a pure-JSvalidateenforces the same.Closes #588
🤖 Generated with Claude Code