From b16aa9c83286a4713aeb69a1e54c7f3687034df1 Mon Sep 17 00:00:00 2001 From: DanielDerefaka Date: Thu, 1 Jan 2026 11:07:16 +0100 Subject: [PATCH 1/3] fix(discord): hide empty Service URL and N/A Ping fields - Only show Service URL field when extractAddress returns a non-empty value - Only show Ping field when ping value is not null - This fixes unnecessary 'https://' and 'N/A' values showing for groups Fixes #3327 Contribution by Gittensor, see my contribution statistics at https://gittensor.io/miners/details?githubId=101010297 --- server/notification-providers/discord.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/server/notification-providers/discord.js b/server/notification-providers/discord.js index 98e97b85f..155281cdc 100644 --- a/server/notification-providers/discord.js +++ b/server/notification-providers/discord.js @@ -58,7 +58,7 @@ class Discord extends NotificationProvider { name: "Service Name", value: monitorJSON["name"], }, - ...(!notification.disableUrl ? [{ + ...((!notification.disableUrl && this.extractAddress(monitorJSON)) ? [{ name: monitorJSON["type"] === "push" ? "Service Type" : "Service URL", value: this.extractAddress(monitorJSON), }] : []), @@ -98,7 +98,7 @@ class Discord extends NotificationProvider { name: "Service Name", value: monitorJSON["name"], }, - ...(!notification.disableUrl ? [{ + ...((!notification.disableUrl && this.extractAddress(monitorJSON)) ? [{ name: monitorJSON["type"] === "push" ? "Service Type" : "Service URL", value: this.extractAddress(monitorJSON), }] : []), @@ -106,10 +106,10 @@ class Discord extends NotificationProvider { name: `Time (${heartbeatJSON["timezone"]})`, value: heartbeatJSON["localDateTime"], }, - { + ...(heartbeatJSON["ping"] != null ? [{ name: "Ping", - value: heartbeatJSON["ping"] == null ? "N/A" : heartbeatJSON["ping"] + " ms", - }, + value: heartbeatJSON["ping"] + " ms", + }] : []), ], }], }; From 1532acaaf3d4c87f1c2d92b7161bcdc119a1549f Mon Sep 17 00:00:00 2001 From: Frank Elsinga Date: Fri, 2 Jan 2026 06:46:50 +0100 Subject: [PATCH 2/3] 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"]})`, From e4552a2184963bf1ab74d74881c512f70fa21f43 Mon Sep 17 00:00:00 2001 From: Frank Elsinga Date: Fri, 2 Jan 2026 06:47:29 +0100 Subject: [PATCH 3/3] simplify extractAddress(monitorJSON) a bit more --- server/notification-providers/discord.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/server/notification-providers/discord.js b/server/notification-providers/discord.js index e560e38d5..4c573d632 100644 --- a/server/notification-providers/discord.js +++ b/server/notification-providers/discord.js @@ -46,8 +46,8 @@ class Discord extends NotificationProvider { } // If heartbeatJSON is not null, we go into the normal alerting loop. + let addess = this.extractAddress(monitorJSON); if (heartbeatJSON["status"] === DOWN) { - let addess = this.extractAddress(monitorJSON); let discorddowndata = { username: discordDisplayName, embeds: [{ @@ -88,7 +88,6 @@ class Discord extends NotificationProvider { return okMsg; } else if (heartbeatJSON["status"] === UP) { - let addess = this.extractAddress(monitorJSON); let discordupdata = { username: discordDisplayName, embeds: [{