You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
The confirmation and the worker emails each build the same participant props, and two props interfaces declare them twice #1036
Two functions build the same props from a commitment row, line for line:
confirmationFor in src/email/notify.ts
workerEmailParts in src/jobs/worker-email.ts
Both compute locale from localeOfSignup(row.signup.settings.locale), then set participantName, signupTitle, manageUrl (via commitmentEditUrl), ...slotText(…) and notes. Each also declares its own local CommitmentRow type.
The props are declared twice as well. CommitmentConfirmationEmailProps (commitment-confirmation.tsx) and ReminderEmailProps (reminder.tsx) each list locale, participantName, signupTitle, manageUrl, slotDetails, slotSummary and notes. #813 merged only the reminder with the slot-change email, so the confirmation's copy is still separate.
As a result, a change to how the manage link or the language is chosen has to be made in two builders and two interfaces.
Fix, in outline
In src/email/commitment-row.ts (already shared by the web and worker paths), add an exported CommitmentRow type and participantEmailProps(db, row, editToken). Make slotText private if nothing else uses it.
Add a ParticipantEmailProps base interface (e.g. in templates/layout.tsx), and have both props interfaces extend it.
confirmationFor spreads the helper and adds quantity and promisesReminder. workerEmailParts spreads participantEmailProps(db, row, editTokenFor(row.commitment.id)) and adds unsubscribeUrl.
Watch for
Keep the editToken parameter. Every production value equals editTokenFor(id) today, but dropping it touches the routes, scripts/confirmation-email.ts and the e2e helper for almost no gain. It would also stop the e2e check from using the server's own token.
This is close to line-neutral (a trial came to about +70/−63). Its value is one place for the rule, not fewer lines.
Rendered emails must not change.
Done when
One helper builds the shared participant props, and both builders use it.
Found by the pipeline's refactor scout in the email code (src/email, src/jobs/worker-email.ts), at c47d56b. Checked by an independent verify agent. It traced every source of the edit token and made the change in a scratch worktree. Typecheck (web and worker tsconfigs), lint, knip, format and pnpm test src/email src/jobs all passed. The props both builders produced for a fixed row were deep-equal before and after. Then it reverted. pnpm test:db couldn't run there. Held back by the scout's cap. Add pipeline:ready to queue it. https://claude.ai/code/session_016YZ9STGBofRAhmGUZoyzWK
Activity