don't call extractAddress twice

This commit is contained in:
Frank Elsinga 2026-01-02 06:46:50 +01:00 committed by GitHub
parent b16aa9c832
commit 1532acaaf3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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"]})`,