feat: add notification preference system with per-type per-channel toggles and admin defaults
Implement configurable notification preferences across in-app and push channels, including a new `notification_preferences` table with soft-delete support, per-user toggle endpoints, admin defaults management, and canonical type definitions. The change introduces `NOTIFICATION_TYPES` and `NOTIFICATION_CHANNELS` constants, `NotificationPrefForm`/`NotificationDefaultForm` models, `notification_enabled` resolution logic, and UI integration via the profile notifications tab and admin panel.
This commit is contained in:
@@ -0,0 +1,74 @@
|
||||
{% set uname = user.get('username') if user else 'YOUR_USERNAME' %}
|
||||
<div class="docs-content" data-render>
|
||||
# Notification settings
|
||||
|
||||
DevPlace notifies you when things happen that involve you: someone comments on your post, replies to
|
||||
your comment, mentions you, upvotes your work, follows you, sends you a direct message, or when you
|
||||
earn a badge, level up, or get an update on a bug you filed. You decide which of these reach you, and
|
||||
how.
|
||||
|
||||
Each notification type can be delivered on two independent channels:
|
||||
|
||||
- **In-app** - the notification appears on DevPlace (the bell in the top navigation and the
|
||||
`/notifications` page).
|
||||
- **Push** - a native web push notification is sent to the devices where you enabled push.
|
||||
|
||||
The two channels are separate: you can keep a type in-app but silence its push, or the other way
|
||||
around.
|
||||
|
||||
## Where to find it
|
||||
|
||||
Open your profile and choose the **Notifications** tab, or go straight to
|
||||
`/profile/{{ uname }}?tab=notifications`. The tab is private: only you (and administrators) can see or
|
||||
change your settings.
|
||||
|
||||
You get one row per notification type with two checkboxes, **In-app** and **Push**. Tick or untick a
|
||||
box and it saves immediately - there is no separate save button.
|
||||
|
||||
## What each type covers
|
||||
|
||||
| Type | Fires when |
|
||||
|------|------------|
|
||||
| Comments | someone comments on your post |
|
||||
| Replies | someone replies to your comment |
|
||||
| Mentions | someone mentions you with `@username` |
|
||||
| Upvotes | someone `++`'d your post, comment, project, or gist |
|
||||
| Followers | someone starts following you |
|
||||
| Direct messages | someone sends you a message |
|
||||
| Badges | you earn a badge |
|
||||
| Level-ups | you reach a new level |
|
||||
| Bug tracker | there is an update on a bug report you filed |
|
||||
|
||||
## Defaults
|
||||
|
||||
Every type and channel is **on** until you turn it off, so notifications work out of the box. A type
|
||||
you have never changed follows the platform default; once you tick or untick a box, your choice is
|
||||
remembered and is no longer affected by later changes to the default.
|
||||
|
||||
Use **Reset to defaults** at the bottom of the tab to clear all of your choices at once and go back to
|
||||
the platform defaults.
|
||||
|
||||
## Turning push on
|
||||
|
||||
Toggling **Push** for a type only has an effect once you have enabled push notifications on the
|
||||
device, which you do with the bell-with-slash button in the top navigation or on the `/notifications`
|
||||
page. Until then, push has nowhere to be delivered. See
|
||||
[Push notifications](/docs/push.html) for the device-side setup.
|
||||
|
||||
## Ask Devii
|
||||
|
||||
You can change these settings in plain language through the Devii assistant, for example:
|
||||
|
||||
> Turn off push notifications for upvotes.
|
||||
|
||||
> Stop notifying me about new followers entirely.
|
||||
|
||||
Devii reads your current settings, makes the change, and can reset everything back to the defaults
|
||||
(it asks you to confirm a reset first, since that clears all of your choices).
|
||||
</div>
|
||||
|
||||
<div class="devii-doc-cta">
|
||||
{% if is_admin(user) %}
|
||||
<a href="/admin/notifications" class="sidebar-link">Notification defaults (admin)</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
Reference in New Issue
Block a user