Expand description
Per-user notification preferences.
Editors opt out of categories of notifications they don’t want
to receive. Every fire-site (workflow_mail, page_subscription,
comment replies) checks is_enabled before delivering so the
mailer doesn’t burn cycles building emails for unsubscribed users.
Missing rows are treated as enabled — first-touch users get every notification until they explicitly disable a category. This matches the principle of least surprise: a new editor hears about everything, then trims.
Structs§
Constants§
- ALL_
KINDS - The full canonical list — rendered in order on the preferences page. (label, kind, hint) for each row.
- COMMENT_
REPLIED - COMMENT_
RESOLVED - PAGE_
PUBLISHED_ SUBSCRIBED - WORKFLOW_
APPROVED - WORKFLOW_
REJECTED - WORKFLOW_
SUBMITTED - Every category an editor can mute. String keys (not an enum) because the set is editor-facing and host plugins may register their own kinds via the same table.
Functions§
- filter_
enabled - Filter
user_idsto those who haven’t opted out ofkind. Missing rows are kept (default = enabled). Used at fan-out sites to skip email composition for muted users. - is_
enabled - Whether
user_idwants to receive notifications ofkind. A missing row is treated astrue— opt-out semantics. - map_
for_ user - Every preference row for a user, keyed by kind.
- pref_
kind_ for_ workflow_ event - Map a workflow event name to the preference kind a recipient uses to mute it. Centralised so the routing stays consistent across every workflow notification call site.
- set_
enabled - Upsert the toggle for
(user_id, kind).