Skip to main content

Module notifications

Module notifications 

Source
Expand description

Notifications and watch lists.

Services create notifications inside the transaction of the event that causes them (a change is submitted, a reviewer decides, a dependent is flagged, …), so they exist exactly when the event happened. Each user sees them in the web UI (bell and page), through the API and in the desktop app; e-mail and Mattermost delivery read the same rows as an outbox (crate::delivery). Users mute kinds and switch channels off on their account page. The actor of an event is never notified about it.

Who is notified:

EventRecipients
change submittedreviewers (review request), watchers of the change
reviewer decides, change released / rejected / withdrawn / cancelledauthor, reviewers, watchers of the change
revision released, revised, made obsolete, checked inwatchers of the item
dependent flagged (change propagation)creator of the dependent, author of its latest revision, its watchers
check-out released by somebody elsethe holder of the lock
change request raisedCAD editors of the affected project groups, watchers of the affected items
change request triaged, assigned, commented, decided, implementedrequester, assignee, commenters, watchers of the request
periodic digest of the requests waiting for triage (request_digests)CAD editors of the project group, e-mail only

Creating an item makes its creator a watcher.

Structs§

Notice
The content of a notification.
Notification
Settings
SettingsUpdate
Watched
What a user watches, for the notifications page and the API.

Enums§

Subject
What a notification is about. Recipients who may not read the subject are left out (notify), so a notification never carries data of a restricted project group to outsiders.

Functions§

generic_text_sql
SQL expression: the notification aliased n is about a group that switched notification_content off (need-to-know, #151): its e-mails and chat posts carry only a generic text and the link, also in direct messages.
is_watching
list
The newest notifications of a user.
mark_read
Marks the given notifications (all if None) of the actor as read and returns the remaining unread count.
open
Marks one notification of the actor as read and returns it (for its link).
restricted_now_sql
SQL expression: the notification aliased n is confidential now – the stored flag, or its subject or something its text names is in a restricted group at delivery time (the group may have been restricted after the row was queued).
send_test
Sends a test notification to the actor (checks e-mail and Mattermost).
set_watch
Starts (watch = true) or stops watching an item or a change. Returns whether the actor watches it afterwards.
settings
unread_count
Unread notifications the actor may still read (a group restricted since, or a lost membership, hides the older ones).
update_settings
Saves the actor’s own notification settings (channels, Mattermost name, muted kinds).
watched
What the actor watches – only what it may still read (the watches of objects it lost access to stay and come back with the access).