Notification center
The bell in the topbar of every panel is the notification center of the logged in user.
- Shows the number of unread notifications of the user in the current
tenant;
99+above 99; nothing without unread ones. - Refreshed every 60 seconds and after reading.
Opening the bell loads the latest 15 notifications, newest first: an icon in the colour of the type, title, body and the time (“5 minutes ago”). Unread ones are highlighted and announced as unread to screen readers. Mark all as read clears the badge.
Reading
Section titled “Reading”Clicking a notification marks it as read on the server (POST) and then opens its link; notifications without a link are only marked as read.
Security
Section titled “Security”- Users only ever see their own notifications of the current tenant.
- Notifications are addressed by UUID; a UUID of another user is not found (404).
- All requests go through the
component endpoint of the panel
(
<panel>:_anvil:notifications) with a token and CSRF protection. - Reading and marking as read are personal state and are not audited.
In code
Section titled “In code”Method of service('notifications') |
Returns |
|---|---|
unreadCount($userId) |
number of unread notifications |
latest($userId, 15) |
the latest notifications: uuid, type, title, body, url, read, created |
open($userId, $uuid) |
marks one as read and returns its link |
markAllRead($userId) |
marks all as read |
All methods work in the current tenant and for the given user only.