Repository navigation
Share one body between the reminder and slot-changed emails - #1151
Conversation
Both worker emails laid out the same seven blocks by hand, so a layout change had to be made twice. SlotHolderEmailBody now renders them once, and each template only picks its own messages and subject. The two "slot changed" headings were one text in every language, kept as two messages. The reminder's changed state now uses the slot-change email's heading, and email.reminder.changed.heading is gone from every catalog and translated-from record. Every rendered email is byte-identical before and after, in en, sv and de. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016YZ9STmKWZ6Lfxhns7rPnH
Tophat: passedWhat changes for people: Nothing. Reminders, "time changed" reminders and slot-changed emails come out exactly as they did before, in English and Swedish.
How: I ran the real app and worker on Not checked: German in the running app (it hasn't shipped; the PR's sample render covers Ran fa5dd39 against e80ce74 locally, no browser screens touched, made-up data. https://claude.ai/code/session_016YZ9SSe3Aw6dEy6QzAhqb6 Generated by Claude Code |
richshaw
left a comment
There was a problem hiding this comment.
Review: passed (round 1)
The PR moves the seven blocks the reminder and slot-changed emails shared into SlotHolderEmailBody. Each template now only picks its messages and subject. The duplicate email.reminder.changed.heading is gone from en, sv and de, and its translated-from records are updated. It meets every "Done when" item in #1148. The body lives in its own file rather than layout.tsx, and the description explains why (it would make an import cycle through slot-details.tsx). Nothing else still uses the deleted key: I searched src, scripts, tests, docs and .claude and found no references. The opt-out label is still its own message, and UnsubscribeFooter still puts it last.
Blocking (0): none
Optional (0): none
Earlier threads: none
Checks: CI is green on fa5dd39 (lint-type-test, e2e, CodeQL). The tophat passed on fa5dd39: all 16 worker emails are byte-identical to main. No runtime code changed after it.
https://claude.ai/code/session_016YZ9SRqSkLjZBSL5CUnH6k
Generated by Claude Code
Fixes #1148.
Session: https://claude.ai/code/session_016YZ9STmKWZ6Lfxhns7rPnH
The problem
ReminderEmailandSlotChangedEmaileach laid out the same seven blocks (layout, heading, intro, slot details, notes, manage button, keep line and opt-out footer) by hand, so any layout change had to be made in both files. Their "slot changed" headings were also two messages with the same text in every language (email.reminder.changed.headingandemail.slotChanged.heading), each translated and reviewed on its own.The fix
src/email/templates/slot-holder-body.tsx(new):SlotHolderEmailBodyrenders the seven blocks once. It takespreview,heading,intro,keepandstopplus the slot props.SlotHolderEmailPropsis the props type both emails share. It's a file of its own, not part oflayout.tsxas the issue suggested, becauseslot-details.tsximportsstrongfromlayout.tsx, and the body needsSlotDetailsText. Putting it inlayout.tsxwould make an import cycle.reminder.tsxandslot-changed.tsxeach pick their messages and subject and render that body.ReminderEmailPropsisSlotHolderEmailPropspluschanged, andSlotChangedEmailPropsisSlotHolderEmailProps.send.tsand the email samples still import them by the same names.email.slotChanged.headingand deletedemail.reminder.changed.headingfromen.json,sv.jsonandde.json. A reminder in the changed state now reads its heading fromemail.slotChanged.mark-translated.mjsdropped the old key from bothtranslated-fromrecords, andto-translate.mjsreports 0 missing and 0 stale forsvandde. The build rewroteen.d.json.ts.UnsubscribeFooter).Tests
mainwithTRANSLATION_SCREENSHOTS=1 pnpm test src/email/templates/emails.test.tsx: confirmation, reminder, changed reminder, slot-changed and sign-in, each in en, sv and de, as HTML and text. Then I did the same on this branch.diff -rfinds no differences. To check the comparison can fail, I dropped the keep line from the shared body: 18 files then differed.emails.test.tsx,worker-render.test.tsandunsubscribe-footer.test.tsxpass unchanged.pnpm lint && pnpm format:check && pnpm typecheck && pnpm knip && pnpm test(3894 passed, 1 expected fail),pnpm test:db(917 passed), andpnpm build && pnpm budgets.🤖 Generated with Claude Code
https://claude.ai/code/session_016YZ9STmKWZ6Lfxhns7rPnH