From ce20c32716b53463c3b5952f1bc07a5d00303b2e Mon Sep 17 00:00:00 2001 From: Thibault Le Ouay Date: Mon, 22 Jan 2024 19:12:42 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix=20email=20data=20(#588)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/api/src/router/monitor.ts | 6 +++--- packages/api/src/router/statusReport.ts | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/api/src/router/monitor.ts b/packages/api/src/router/monitor.ts index 764c8cd4..20a245c8 100644 --- a/packages/api/src/router/monitor.ts +++ b/packages/api/src/router/monitor.ts @@ -75,7 +75,7 @@ export const monitorRouter = createTRPCRouter({ .returning() .get(); - if (Boolean(notifications.length)) { + if (notifications.length > 0) { // We should make sure the user has access to the notifications const allNotifications = await opts.ctx.db.query.notification.findMany({ where: inArray(notification.id, notifications), @@ -165,7 +165,7 @@ export const monitorRouter = createTRPCRouter({ ?.includes(x), ); - if (Boolean(addedNotifications.length)) { + if (addedNotifications.length > 0) { const values = addedNotifications.map((notificationId) => ({ monitorId: currentMonitor.id, notificationId, @@ -178,7 +178,7 @@ export const monitorRouter = createTRPCRouter({ .map(({ notificationId }) => notificationId) .filter((x) => !notifications?.includes(x)); - if (Boolean(removedNotifications.length)) { + if (removedNotifications.length > 0) { await opts.ctx.db .delete(notificationsToMonitors) .where( diff --git a/packages/api/src/router/statusReport.ts b/packages/api/src/router/statusReport.ts index 9b43f013..ae482ca8 100644 --- a/packages/api/src/router/statusReport.ts +++ b/packages/api/src/router/statusReport.ts @@ -131,7 +131,7 @@ export const statusReportRouter = createTRPCRouter({ await sendEmailHtml({ to: subscribersEmails, subject: `New status update for ${pageInfo.title}`, - html: `

Hi,

${pageInfo.title} just posted an update on their status page:

New Status : ${statusReportUpdate.status}

${statusReportUpdate.message}

Powered by OpenStatus

+ html: `

Hi,

${pageInfo.title} just posted an update on their status page:

New Status : ${updatedValue.status}

${updatedValue.message}

Powered by OpenStatus

`, from: "Notification OpenStatus ", }); -- 2.51.2