This commit is contained in:
Stefan Lazic committed 2026-08-04 09:57:58 +01:00
1 parent 546613e677
commit 4785510144
82 files changed
+4903 -287

No files matched your search

+10 -1
View File
@@ -5,6 +5,7 @@ import type { EmailProvider } from "./providers/email-provider";
import type { PushProvider } from "./providers/push-provider";
import { getOwnerUserIds } from "./recipients";
import { renderEmailForNotification } from "./render-email";
import { getBranding } from "@/lib/business/branding";
/**
* The background notification processor — the one place EMAIL and PUSH
@@ -161,6 +162,7 @@ async function processEmailDelivery(prisma: PrismaClient, delivery: DueDelivery,
const sendResult = await emailProvider.sendEmail({
to: { email: recipientEmail },
sender: email.sender,
subject: email.subject,
html: email.html,
text: email.text,
@@ -202,10 +204,17 @@ async function processPushDelivery(prisma: PrismaClient, delivery: DueDelivery,
let lastFailureReason = "";
let anyRetryable = false;
// Every notify() call sets a subject (see notification.service.ts),
// so this fallback is defensive rather than a normal path — but a
// push notification's title is genuinely user-visible (shown by the
// OS), so it still needs the business name, not the internal product
// name, when reached.
const fallbackTitle = delivery.notification.subject ?? (await getBranding()).name;
for (const subscription of subscriptions) {
const sendResult = await pushProvider.sendPush({
subscription: { endpoint: subscription.endpoint, p256dhKey: subscription.p256dhKey, authKey: subscription.authKey },
title: delivery.notification.subject ?? "NextChair",
title: fallbackTitle,
body: delivery.notification.bodyText,
deepLinkPath: delivery.notification.deepLinkPath ?? undefined,
});