Skip to content

Share one body between the reminder and slot-changed emails - #1151

Merged
richshaw merged 2 commits into
mainfrom
claude/issue-1148-slot-holder-email-body
Nov 28, 2026
Merged

richshaw merged 2 commits into
mainfrom
claude/issue-1148-slot-holder-email-body

Conversation

@richshaw

@richshaw richshaw commented Nov 28, 2026 •

Copy link
Copy Markdown
Owner

Fixes #1148.
Session: https://claude.ai/code/session_016YZ9STmKWZ6Lfxhns7rPnH

The problem

ReminderEmail and SlotChangedEmail each 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.heading and email.slotChanged.heading), each translated and reviewed on its own.

The fix

  • src/email/templates/slot-holder-body.tsx (new): SlotHolderEmailBody renders the seven blocks once. It takes preview, heading, intro, keep and stop plus the slot props. SlotHolderEmailProps is the props type both emails share. It's a file of its own, not part of layout.tsx as the issue suggested, because slot-details.tsx imports strong from layout.tsx, and the body needs SlotDetailsText. Putting it in layout.tsx would make an import cycle.
  • reminder.tsx and slot-changed.tsx each pick their messages and subject and render that body. ReminderEmailProps is SlotHolderEmailProps plus changed, and SlotChangedEmailProps is SlotHolderEmailProps. send.ts and the email samples still import them by the same names.
  • One heading. I kept email.slotChanged.heading and deleted email.reminder.changed.heading from en.json, sv.json and de.json. A reminder in the changed state now reads its heading from email.slotChanged. mark-translated.mjs dropped the old key from both translated-from records, and to-translate.mjs reports 0 missing and 0 stale for sv and de. The build rewrote en.d.json.ts.
  • The opt-out label is still its own message and still comes last (UnsubscribeFooter).
  • No CHANGELOG entry, because no email changes.

Tests

  • Every email is byte-identical. I wrote out all 15 sample emails on main with TRANSLATION_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 -r finds 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.ts and unsubscribe-footer.test.tsx pass unchanged.
  • Ran and passed: pnpm lint && pnpm format:check && pnpm typecheck && pnpm knip && pnpm test (3894 passed, 1 expected fail), pnpm test:db (917 passed), and pnpm build && pnpm budgets.

🤖 Generated with Claude Code

https://claude.ai/code/session_016YZ9STmKWZ6Lfxhns7rPnH

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
@richshaw richshaw added pipeline:tophat pipeline:working A session is working on it right now and removed pipeline:working A session is working on it right now labels Nov 28, 2026 — with Claude

Copy link
Copy Markdown
Owner Author

Tophat: passed

What changes for people: Nothing. Reminders, "time changed" reminders and slot-changed emails come out exactly as they did before, in English and Swedish.

Check Result What I saw
Slot-changed email, sent by the worker after an organizer moved the slot (en, sv) ✅ Text and HTML identical to the same email on main
Reminder after a move, the changed state that now reads its heading from email.slotChanged (en, sv) ✅ Identical to main; Swedish heading still "Tiden har ändrats"
Plain reminder (en, sv) ✅ Identical to main, notes block and opt-out footer last as before
Confirmation emails sent from the web process (neighbour) ✅ Identical to main
Server and worker logs ✅ No errors on either commit

How: I ran the real app and worker on main and then on this PR, each on a fresh database, with the same steps through the API and the reminder dispatch: two published signups (one switched to Swedish), participants signing up, the slot moved and the move backdated past the settle window, then reminders dispatched. A local, uncommitted change to the console transport saved each email's HTML and text. I paired all 16 participant emails from the PR's run with the main run by recipient and subject. After swapping out links and ids, text and HTML were byte-identical for all 16. To check the comparison could fail, I edited one word in one saved email, and it was flagged.

Not checked: German in the running app (it hasn't shipped; the PR's sample render covers de).

Ran fa5dd39 against e80ce74 locally, no browser screens touched, made-up data. https://claude.ai/code/session_016YZ9SSe3Aw6dEy6QzAhqb6


Generated by Claude Code

@richshaw richshaw added pipeline:review pipeline:working A session is working on it right now and removed pipeline:tophat pipeline:working A session is working on it right now labels Nov 28, 2026 — with Claude

@richshaw richshaw left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@richshaw richshaw added pipeline:merge pipeline:working A session is working on it right now and removed pipeline:review pipeline:working A session is working on it right now labels Nov 28, 2026 — with Claude
@richshaw
richshaw merged commit 19088ea into main Nov 28, 2026
5 checks passed
@richshaw
richshaw deleted the claude/issue-1148-slot-holder-email-body branch November 28, 2026 12:32
@richshaw richshaw removed pipeline:merge pipeline:working A session is working on it right now labels Nov 28, 2026 — with Claude
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.

The reminder and slot-changed emails each lay out the same body, and their "slot changed" heading is translated twice

2 participants