From 6a3eccf6a6631e249658c749f6a1bd3466347f92 Mon Sep 17 00:00:00 2001 From: Matthew Nickson Date: Sun, 2 Oct 2022 02:26:38 +0100 Subject: [PATCH] Fixed alert features unnecessary URL field #2009 The filling of the URL field was incorrect previously. It has been updated to handle new monitor types. Signed-off-by: Matthew Nickson --- server/notification-providers/teams.js | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/server/notification-providers/teams.js b/server/notification-providers/teams.js index c398e03c2..bcfc82c24 100644 --- a/server/notification-providers/teams.js +++ b/server/notification-providers/teams.js @@ -63,7 +63,7 @@ class Teams extends NotificationProvider { }); } - if (monitorUrl) { + if (monitorUrl && monitorUrl !== "https://") { facts.push({ name: "URL", value: monitorUrl, @@ -127,13 +127,17 @@ class Teams extends NotificationProvider { let url; - if (monitorJSON["type"] === "port") { - url = monitorJSON["hostname"]; - if (monitorJSON["port"]) { - url += ":" + monitorJSON["port"]; - } - } else { - url = monitorJSON["url"]; + switch (monitorJSON["type"]) { + case "http": + case "keywork": + url = monitorJSON["url"]; + break; + case "docker": + url = monitorJSON["docker_host"]; + break; + default: + url = monitorJSON["hostname"]; + break; } const payload = this._notificationPayloadFactory({