From 9f563adc1a1f1ec5d714b65f96fab4f23187e255 Mon Sep 17 00:00:00 2001 From: Frank Elsinga Date: Thu, 13 Jun 2024 17:04:38 +0200 Subject: [PATCH] fixed formatting mistakes --- server/notification-providers/discord.js | 2 +- server/notification-providers/notification-provider.js | 7 +++---- server/notification-providers/sevenio.js | 2 +- server/notification-providers/zoho-cliq.js | 4 +--- 4 files changed, 6 insertions(+), 9 deletions(-) diff --git a/server/notification-providers/discord.js b/server/notification-providers/discord.js index 38b88fe94..ccb80bf40 100644 --- a/server/notification-providers/discord.js +++ b/server/notification-providers/discord.js @@ -48,7 +48,7 @@ class Discord extends NotificationProvider { }, { name: monitorJSON["type"] === "push" ? "Service Type" : "Service URL", - value: monitorJSON["type"] === "push" ? "Heartbeat" : address, + value: this.extractAdress(monitorJSON), }, { name: `Time (${heartbeatJSON["timezone"]})`, diff --git a/server/notification-providers/notification-provider.js b/server/notification-providers/notification-provider.js index 1a3a36125..d26b791f6 100644 --- a/server/notification-providers/notification-provider.js +++ b/server/notification-providers/notification-provider.js @@ -21,13 +21,12 @@ class NotificationProvider { /** * Extracts the address from a monitor JSON object based on its type. - * * @param {?object} monitorJSON Monitor details (For Up/Down only) * @returns {string} The extracted address based on the monitor type. */ - extractAdress(monitorJSON){ + extractAdress(monitorJSON) { if (!monitorJSON) { - return "" + return ""; } switch (monitorJSON["type"]) { case "push": @@ -41,7 +40,7 @@ class NotificationProvider { if (monitorJSON["port"]) { return monitorJSON["hostname"] + ":" + monitorJSON["port"]; } - return monitorJSON["hostname"] + return monitorJSON["hostname"]; default: if (![ "https://", "http://", "" ].includes(monitorJSON["url"])) { return monitorJSON["url"]; diff --git a/server/notification-providers/sevenio.js b/server/notification-providers/sevenio.js index e422ff1fb..9d805d7e6 100644 --- a/server/notification-providers/sevenio.js +++ b/server/notification-providers/sevenio.js @@ -32,7 +32,7 @@ class SevenIO extends NotificationProvider { return okMsg; } - let address = extractAdress(monitorJSON); + let address = this.extractAdress(monitorJSON); if (address !== "") { address = `(${address}) `; } diff --git a/server/notification-providers/zoho-cliq.js b/server/notification-providers/zoho-cliq.js index 76a059683..44681b7df 100644 --- a/server/notification-providers/zoho-cliq.js +++ b/server/notification-providers/zoho-cliq.js @@ -82,12 +82,10 @@ class ZohoCliq extends NotificationProvider { return okMsg; } - - const payload = this._notificationPayloadFactory({ monitorMessage: heartbeatJSON.msg, monitorName: monitorJSON.name, - monitorUrl: address, + monitorUrl: this.extractAdress(monitorJSON), status: heartbeatJSON.status });