fix(audit): wire reminder defaults into createInterest; doc branding gap (R2-H15/H16)

R2-H16: /admin/reminders persisted defaultEnabled + defaultDays to
system_settings but createInterest ignored them — every new interest
defaulted to reminderEnabled=false regardless. The validator now
treats reminderEnabled / reminderDays as optional (no default false),
and createInterest falls back to getPortReminderConfig(portId) when
the caller omits them. Explicit false / null still opts out.

R2-H15: branding admin (/admin/branding) saves 5 settings that no
code reads — the email templates and BrandedAuthShell hardcode Port
Nimara branding. Wiring it end-to-end is a multi-template refactor;
documented the gap inline above getPortBrandingConfig with a
step-by-step wire-up plan so future devs don't think it's done.

The reminder-digest scheduler (digestEnabled/digestTime/digestTimezone)
remains unimplemented — needs a new BullMQ recurring job that batches
pending reminders into per-user/per-port digest emails. Out of scope
for this audit pass.

1175/1175 vitest passing.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Matt Ciaccio
2026-05-06 22:28:41 +02:00
parent c312cd3685
commit 0a5f085a9e
3 changed files with 33 additions and 1 deletions

View File

@@ -237,6 +237,25 @@ export async function listDocumensoWebhookSecrets(): Promise<DocumensoSecretEntr
// ─── Branding ───────────────────────────────────────────────────────────────
/**
* NOT YET WIRED end-to-end. The `/admin/branding` page persists these
* settings to system_settings, but the email templates in
* `src/lib/email/templates/` and the `<BrandedAuthShell>` component in
* `src/components/shared/branded-auth-shell.tsx` still hardcode the
* `s3.portnimara.com` logo URL and the Port Nimara color palette. A
* second port wired into this CRM will see Port Nimara branding in
* every transactional email until those consumers call
* `getPortBrandingConfig(portId)`. Tracked as audit finding R2-H15.
*
* To wire fully:
* 1. Take `branding` config as a server-side prop into
* `<BrandedAuthShell>` (pass it from the page server component).
* 2. Refactor the email shell helper in each `templates/*.ts` module
* to take `headerHtml` / `footerHtml` / `primaryColor` instead of
* the inline constants.
* 3. In each sender, call `getPortBrandingConfig(portId)` and thread
* the branding values into the template call.
*/
export interface PortBrandingConfig {
logoUrl: string | null;
primaryColor: string;