Files
Pulse/internal
rcourtman b0128010be feat(notifications): add structured email subject prefix, brand name, and footer note (#4868)
## Summary
Addresses #1523 and #1543 safely using structured plain-text fields
inside the compiled-in email template (no raw HTML or custom template
files):
- **Backend (`EmailConfig`, `email_template.go`, `email_subject.go`,
`notifications.go`):**
- Adds optional `SubjectPrefix` (≤64 runes), `BrandName` (≤80 runes),
and `FooterNote` (≤240 runes) fields normalized via
`NormalizeEmailBranding` (strips `\r`, `\n`, and control characters,
collapses whitespace, enforces rune bounds) and HTML-escaped on render.
- Applies overrides across single, grouped, resolved, and test emails
while preserving byte-compatible defaults (`[Pulse Alert]`, `Pulse
Monitoring`, no extra footer note) when omitted/blank.
- `PUT /api/notifications/email` preserves omitted branding fields via
`presenceCheck` and clears them on explicit empty strings.
- Excludes branding text from
`notificationDeliveryConfigurationFingerprint` so branding edits never
disrupt email destination continuity.
- **Frontend (`EmailProviderSelect.tsx`, `alertEmailPresentation.ts`,
`alertDestinationsModel.ts`, `helpers.ts`, `api/notifications.ts`):**
- Exposes **Subject prefix**, **Brand name**, and **Footer note** inside
the collapsed-by-default **Advanced options** disclosure under `Email
branding & subject` on `/alerts/notifications`, immediately previewable
via **Send test email**.

## Verification
- Go tests: `internal/notifications` (`email_branding_test.go`,
`TestEmail*`, `TestResolvedEmail*`, `TestContractGroupedEmail*`) and
`internal/api/alerting` (`email_branding_test.go`,
`TestNotificationHandlers/*EmailConfig`) — all passed.
- Frontend: `86/86` Vitest tests (`EmailProviderSelect.test.tsx`,
`EmailProviderSelect.supported-settings.test.tsx`,
`alertDestinationsModel*.test.ts`, `notifications.test.ts`,
`alertEmailPresentation.test.ts`), `tsc --noEmit`, `vite build`, and
`check-bundle-size.mjs` (`All chunks within budget`).
- Browser verification (receipt
`frontend-modern/browser-verification/b1a9edccf1228424.json`):
Playwright exercised `/alerts/notifications` at `1280x900` (light &
dark) and `390x844` (mobile light) — verified collapsed default,
expanding **Advanced options**, filling all 3 fields, **Send test
email** draft payload, **Save** payload + reload persistence,
re-collapsing, zero overflow, zero page errors, and pixel-inspected
screenshots.
- Full pre-commit governance & lint suite passed.
2026-11-21 23:36:14 +00:00
..