Repository navigation
feat(dms): let a subject offer e-mail and a mail module deliver it - #1126
Merged
Merged
Conversation
Upd4ting
force-pushed
the
feat/notification-email-channel
branch
from
November 20, 2026 14:48
da606d4 to
4bfbfc8
Compare
…n a channel is registered
A subject now offers e-mail with email?: boolean | { defaultOn?: boolean }
and a mail module registers it with NotificationEmailChannel({ deliver }).
The one-member channel id union, the generic @<channel> key parsing and the
frontend's copy of the channel id type are gone; the frontend reads every
switch default through one function.
An unregister now clears the channel only when it names the live registration, stamped with a RegistrationIdentity, so a hot reload no longer turns e-mail off. deliver receives the notification id directly, SendOptions holds the one tenantId, and a subject off in the app shows its e-mail switch off.
Upd4ting
force-pushed
the
feat/notification-email-channel
branch
from
November 20, 2026 17:45
a8a1823 to
9d35ac4
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The account page's notification preferences show an « E-mail » column marked « Bientôt » / "Soon" with nothing behind it. This PR lets a subject offer e-mail and lets a mail module deliver it. Once a module registers the e-mail channel, each subject that offers e-mail gets an Email switch, and every new in-app notification of that subject is handed to the channel for the users who have it on.
Takeover of Maxime's PR, rebased on
main. The edit to.agents/skills/verify-dms/features/settings-account.mdis dropped, since #1172 deleted that file. Per Antony's review, the generic channel model is collapsed to the one channel that exists: e-mail.Final contract (
@antelopejs/interface-dms/notifications), consumed by AntelopeJS/dms-mailing#197NotificationSubjectInfo.emailboolean | { defaultOn?: boolean }, optionalNotificationEmailChannel(channel)channeland returns itNotificationEmailChannelInfo{ deliver(userId, data, notificationId) }.notificationIdis the stored in-app row's id; a keyed send's row id already derives from its keyinternal.RegisterNotificationEmailChannelRegisteringProxy<(info: NotificationEmailChannelInfo) => void>internal.emailChannelIdentityRegistrationIdentitystamped byNotificationEmailChannel(), so an unload clears the channel only when it is the live oneSendOptions.tenantId,NotificationData.tenantIdstring, optional. dms-mailing#197 sends nothing without it.toRoleskeeps its recipient filterRoleSendOptionsinterface RoleSendOptions extends SendOptions {}: its only own field,tenantId, moved toSendOptions; it stays an interface so declaration merging still worksEverything is additive and optional against
main. Against Maxime's version,channels,NotificationChannel(id, …),NotificationChannelId,NotificationChannelOffer(s),NotificationChannelInfoandNotificationDeliveryContext(with its unreadidempotencyKey) are gone.What changed in the review
channels: { email: … }becameemail?: boolean | { defaultOn?: boolean }. The one-memberNotificationChannelIdunion and the per-id channel map are deleted.@<channel>suffix. It accepts<category>:<subject>@emailonly, when the subject offers e-mail and the channel is registered. Any other key gets a 400.GET …/notifications/categoriesreturnsemailChannel: booleanin place ofchannels: string[]. Each subject carriesemail: { defaultOn }only when it offers e-mail and the channel is registered.defaultOnsubject's switch on.channelPreferenceKey(subject, channel)andhasChannel(channel)are gone. Every switch reads its value through oneread(key): the stored choice, else the e-mail default, else on. TheoffersEmailprop is gone: the row readssubject.email.notification-channels.tsbecamenotification-email.ts, and the docs pagedelivery-channelsbecameemail.Behaviour, unchanged from Maxime's version
"<category>:<subject>@email", in the existinguser_notification_preferences.preferencesmap, read at send time with the subject'sdefaultOnas fallback.SendToUser, which every send goes through, hands the notification to the channel after the in-app row is stored and published. A subject turned off in the app, a repeat inside the 10-second window and an idempotent retry store no row, so they mail nothing.deliverthat throws is logged as[DMS] Notification e-mail channel failed to deliver …, and the send still resolves.—cells and its hint.flowchart TD S[notification.toUser / toUsers / toRoles / broadcast] --> U[SendToUser] U --> P{in-app on, or subject locked?} P -- no --> X[skip] P -- yes --> R[store row, publish realtime] R -- row already stored: retry or repeat --> X R --> C{e-mail channel registered and subject.email?} C -- no --> D[done] C -- yes --> E{locked, or stored @email key, else defaultOn} E -- off --> D E -- on --> M[channel.deliver userId, data, notificationId] M -- throws --> L[log, send resolves]⚠ sensitive: adds to the interface-dms notifications contract and a new stored preference key format
Related issue
W05057e83-9. Consumed by AntelopeJS/dms-mailing#197.
Verification
The integration test
src/test/integration/notification-email.test.ts(12 tests, fake channel) against Maxime's contract, by checking out hisinterface-dms/src/notificationsand typecheckingpackages/dms:After:
The hot-reload case,
keeps mailing when a replaced registration unloads after its replacement, against Maxime's unconditional unregister (mutant) and after:notification-preferences-email.test.tsnow asserts a subject off in the app shows its e-mail switch off. Against the previousisEmailEnabled:AssertionError: expected 'true' to be 'false',1 failed | 3 passed. After:4 passed.Also run locally:
pnpm run checks: 12 passed, 0 failed.pnpm run typecheck: clean.frontend-vuevitest onnotification(7 files, 33 tests, includingnotification-preferences-email.test.ts): passing.Attention
@emailwould collide with the e-mail key of the subject named without it. No subject id contains@today; only an odd id triggers it.Follow-ups
NotificationChannel("email", { deliver }), which this PR removes, done means it callsNotificationEmailChannel({ deliver })withdeliver(userId, data, notificationId)and its docs showemail: trueon a subject.Checklist