feat: granular per-category push notification settings
New Settings → Notifications section with a toggle per category (follow, comment, reply, reaction, rating, mention, leftover-expiring, shared shopping list) — previously it was all-or-nothing (browser permission only). userNotificationPrefs (one row per user, defaults all-on so existing users see no behavior change until they opt out of something). Gated the push send in the three places that dispatch one: lib/notifications.ts (the 6 in-app notification types), the leftover-expiry cron, and shopping-list-notify — in-app notification-center entries and email are unaffected, this only gates the push itself, matching the literal ask. Verified locally: GET/PUT round-trips correctly, disabling a category and confirming the settings page renders all 8 toggles.
This commit is contained in:
@@ -2,6 +2,7 @@ import type { Metadata } from "next";
|
||||
import { headers } from "next/headers";
|
||||
import { auth } from "@/lib/auth/server";
|
||||
import { PushSubscribeButton } from "@/components/pwa/push-subscribe-button";
|
||||
import { NotificationCategoriesForm } from "@/components/settings/notification-categories-form";
|
||||
import { getMessages } from "@/lib/i18n/server";
|
||||
|
||||
export const metadata: Metadata = {};
|
||||
@@ -21,6 +22,16 @@ export default async function NotificationsPage() {
|
||||
</div>
|
||||
<PushSubscribeButton />
|
||||
</section>
|
||||
|
||||
<section className="rounded-xl border p-6 space-y-4">
|
||||
<div>
|
||||
<h2 className="font-semibold text-lg">{m.settingsForm.notificationCategories.title}</h2>
|
||||
<p className="text-sm text-muted-foreground mt-1">
|
||||
{m.settingsForm.notificationCategories.description}
|
||||
</p>
|
||||
</div>
|
||||
<NotificationCategoriesForm />
|
||||
</section>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user