From 1532acaaf3d4c87f1c2d92b7161bcdc119a1549f Mon Sep 17 00:00:00 2001 From: Frank Elsinga Date: Fri, 2 Jan 2026 06:46:50 +0100 Subject: [PATCH] don't call extractAddress twice --- server/notification-providers/discord.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/server/notification-providers/discord.js b/server/notification-providers/discord.js index 155281cdc..e560e38d5 100644 --- a/server/notification-providers/discord.js +++ b/server/notification-providers/discord.js @@ -47,6 +47,7 @@ class Discord extends NotificationProvider { // If heartbeatJSON is not null, we go into the normal alerting loop. if (heartbeatJSON["status"] === DOWN) { + let addess = this.extractAddress(monitorJSON); let discorddowndata = { username: discordDisplayName, embeds: [{ @@ -58,9 +59,9 @@ class Discord extends NotificationProvider { name: "Service Name", value: monitorJSON["name"], }, - ...((!notification.disableUrl && this.extractAddress(monitorJSON)) ? [{ + ...((!notification.disableUrl && addess) ? [{ name: monitorJSON["type"] === "push" ? "Service Type" : "Service URL", - value: this.extractAddress(monitorJSON), + value: addess, }] : []), { name: `Time (${heartbeatJSON["timezone"]})`, @@ -87,6 +88,7 @@ class Discord extends NotificationProvider { return okMsg; } else if (heartbeatJSON["status"] === UP) { + let addess = this.extractAddress(monitorJSON); let discordupdata = { username: discordDisplayName, embeds: [{ @@ -98,9 +100,9 @@ class Discord extends NotificationProvider { name: "Service Name", value: monitorJSON["name"], }, - ...((!notification.disableUrl && this.extractAddress(monitorJSON)) ? [{ + ...((!notification.disableUrl && addess) ? [{ name: monitorJSON["type"] === "push" ? "Service Type" : "Service URL", - value: this.extractAddress(monitorJSON), + value: addess, }] : []), { name: `Time (${heartbeatJSON["timezone"]})`,