From 041a26154033a6ad4c134c56c5dfb883d5883f06 Mon Sep 17 00:00:00 2001 From: karenvicent Date: Fri, 12 Sep 2025 10:13:38 -0400 Subject: [PATCH] add llama sugestions --- server/src/service/infrastructure/notificationService.js | 4 ++-- server/src/service/infrastructure/notificationUtils.js | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/server/src/service/infrastructure/notificationService.js b/server/src/service/infrastructure/notificationService.js index ff92360e2..96fc53592 100644 --- a/server/src/service/infrastructure/notificationService.js +++ b/server/src/service/infrastructure/notificationService.js @@ -16,7 +16,7 @@ class NotificationService { return NotificationService.SERVICE_NAME; } - sendNotification = async ({ notification, subject, content, html, discordContent }) => { + sendNotification = async ({ notification, subject, content, html, discordContent = null }) => { const { type, address } = notification; if (type === "email") { @@ -79,7 +79,7 @@ class NotificationService { return success; } - async notifyAll({ notificationIDs, subject, html, content, discordContent }) { + async notifyAll({ notificationIDs, subject, html, content, discordContent = null }) { const notifications = await this.db.notificationModule.getNotificationsByIds(notificationIDs); // Map each notification to a test promise const promises = notifications.map(async (notification) => { diff --git a/server/src/service/infrastructure/notificationUtils.js b/server/src/service/infrastructure/notificationUtils.js index 62404ee29..b32886d52 100644 --- a/server/src/service/infrastructure/notificationUtils.js +++ b/server/src/service/infrastructure/notificationUtils.js @@ -74,7 +74,7 @@ class NotificationUtils { let discordMessageText = { embeds: [ { - title: status ? "Uptime Alert: One of your monitors is back online" : "Downtime Alert: One of your monitors went offline", + title: status ? dn.uptimeAlert : dn.downtimeAlert, color: status ? 5763719 : 15548997, fields: [ @@ -129,9 +129,9 @@ class NotificationUtils { description: `Your current disk usage is above your threshold (${(diskThreshold * 100).toFixed(0)}%)`, color: 15548997, footer: { text: "Checkmate" }, - fields: disk.map((d, idx) => ({ + fields: (Array.isArray(disk) ? disk : []).map((d, idx) => ({ name: `Disk ${idx}`, - value: `${(d.usage_percent * 100).toFixed(0)}%`, + value: `${(d?.usage_percent * 100).toFixed(0)}%`, inline: true, })), }),