fix(notifications): show the mood reminder's real default in the matrix

The /notifications matrix read the constant default table, where the
mood reminder is off, while delivery derives it from the reminder card.
An account receiving the reminder saw every one of its channel switches
off.

The no-row default now lives in one resolver that delivery and the
preferences read both use. GET /api/notifications/preferences publishes
it as `eventDefaults`, the matrix renders a switch without a stored row
from that map, and the reminder card refreshes the matrix when it flips.
This commit is contained in:
Marc-André Bombeck committed 2026-10-21 12:01:53 +02:00
1 parent 421aacf457
commit dc704b5e63
10 files changed
+487 -27

No files matched your search

+6 -1
View File
@@ -66,7 +66,7 @@ const notificationPreference = z
.meta({
id: "NotificationPreference",
description:
"An explicit per-(channel, event) override. Only STORED rows appear — an event with no row here follows the server-side default for that category, which is ON for most and OFF for the opt-in ones (personal records, mood and cycle reminders). Absence is therefore not 'disabled'.",
"An explicit per-(channel, event) override. Only STORED rows appear — an event with no row here follows `eventDefaults` on the same response. Absence is therefore not 'disabled'.",
});
const notificationPreferencesResponse = z
@@ -78,6 +78,11 @@ const notificationPreferencesResponse = z
.describe(
"Every event category the server knows, in declaration order — the list a client renders rows for.",
),
eventDefaults: z
.record(eventTypeEnum, z.boolean())
.describe(
"What each event does on a channel with no stored row, resolved for this account by the function delivery uses. Most are constant per category; the mood reminder follows the account's mood-reminder setting (`moodReminderEnabled` on `/api/user/profile`). Render a switch without a row from this map rather than from a copy of the defaults. Since v1.43.11.",
),
})
.meta({
id: "NotificationPreferencesResponse",