feat: redesign notifications settings with per-category in-app/push table
All checks were successful
Release / Test backend (push) Successful in 53s
Release / Check ui (push) Successful in 1m49s
Release / Docker (push) Successful in 5m49s
Release / Gitea Release (push) Successful in 21s

- Add notify_new_chapters_push field to AppUser, PATCH /api/profile, and profile loader
- Fix bell panel to reload notifications on every open (not just once on mount)
- Replace flat in-app + push toggles with structured category table (Category | In-app | Push)
- Add browser push master subscribe/unsubscribe row above the table
- Push column toggle disabled until browser is subscribed; shows — when unsupported/denied
- Update Notifications row hint to summarise active channels (In-app · Push / Off)
This commit is contained in:
root
2026-04-12 17:56:53 +05:00
parent 761ca83da5
commit a0e705beec
5 changed files with 108 additions and 45 deletions

View File

@@ -7,7 +7,7 @@ import { log } from '$lib/server/logger';
* PATCH /api/profile
*
* Update mutable profile preferences (currently: notification preferences).
* Body: { notify_new_chapters?: boolean }
* Body: { notify_new_chapters?: boolean, notify_new_chapters_push?: boolean }
*/
export const PATCH: RequestHandler = async ({ locals, request }) => {
if (!locals.user) error(401, 'Not authenticated');
@@ -19,10 +19,13 @@ export const PATCH: RequestHandler = async ({ locals, request }) => {
error(400, 'Invalid JSON');
}
const prefs: { notify_new_chapters?: boolean } = {};
const prefs: { notify_new_chapters?: boolean; notify_new_chapters_push?: boolean } = {};
if (typeof body.notify_new_chapters === 'boolean') {
prefs.notify_new_chapters = body.notify_new_chapters;
}
if (typeof body.notify_new_chapters_push === 'boolean') {
prefs.notify_new_chapters_push = body.notify_new_chapters_push;
}
if (Object.keys(prefs).length === 0) {
error(400, 'No valid preferences provided');