Extract shared brandingVars() helper to eliminate duplication #17

Merged
matt merged 1 commit from mailship-90c-extract-shared-brandingvars-helper-brand-e34 into main 2026-09-16 14:37:20 +00:00
Collaborator

mailship-90c

Extract a shared brandingVars() helper that builds the branding object once, replacing three identical inline object literals in the /confirm handler.

The { brandName, brandAccent, brandLogo, settingsUrl } object was constructed identically at three call sites in src/server.ts: the confirm-error path (no-token guard), the confirm-success path, and the confirm-error catch block. This change adds a small local factory function and spreads it at each site, reducing the four-line literal to a single line per call. Any future branding changes will need only one edit instead of three.

mailship-90c Extract a shared `brandingVars()` helper that builds the branding object once, replacing three identical inline object literals in the `/confirm` handler. The `{ brandName, brandAccent, brandLogo, settingsUrl }` object was constructed identically at three call sites in `src/server.ts`: the `confirm-error` path (no-token guard), the `confirm-success` path, and the `confirm-error` catch block. This change adds a small local factory function and spreads it at each site, reducing the four-line literal to a single line per call. Any future branding changes will need only one edit instead of three.
hudson added 1 commit 2026-09-16 13:57:19 +00:00
extract shared brandingVars() helper to eliminate duplication
All checks were successful
CI / checks (pull_request) Successful in 35s
4b43664411
The { brandName, brandAccent, brandLogo, settingsUrl } object was built
identically 3 times in the /confirm handler. Extract a brandingVars()
helper so it is defined once and reused via spread.

Closes mailship-90c
matt approved these changes 2026-09-16 14:37:16 +00:00
matt merged commit 2ee4e53bd9 into main 2026-09-16 14:37:20 +00:00
matt deleted branch mailship-90c-extract-shared-brandingvars-helper-brand-e34 2026-09-16 14:37:27 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: matt/mailship#17
No description provided.