From a6072a0e306d44c5a5094601e8d6661e31f50878 Mon Sep 17 00:00:00 2001
From: Philipp Bischoff
Date: Wed, 15 Dec 2021 13:40:21 +0100
Subject: [PATCH] google chat: only show offline message in notification when
service went down
---
server/notification-providers/google-chat.js | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/server/notification-providers/google-chat.js b/server/notification-providers/google-chat.js
index 897dd691b..1610553c7 100644
--- a/server/notification-providers/google-chat.js
+++ b/server/notification-providers/google-chat.js
@@ -2,7 +2,7 @@ const NotificationProvider = require("./notification-provider");
const axios = require("axios");
const { setting } = require("../util-server");
const { getMonitorRelativeURL } = require("../../src/util");
-const { UP } = require("../../src/util");
+const { DOWN, UP } = require("../../src/util");
class GoogleChat extends NotificationProvider {
@@ -15,16 +15,16 @@ class GoogleChat extends NotificationProvider {
let textMsg = ''
if (heartbeatJSON && heartbeatJSON.status === UP) {
- textMsg = `✅ Application is back online`;
- } else {
- textMsg = `🔴 Application went down`;
+ textMsg = `✅ Application is back online\n`;
+ } else if (heartbeatJSON && heartbeatJSON.status === DOWN) {
+ textMsg = `🔴 Application went down\n`;
}
if (monitorJSON && monitorJSON.name) {
- textMsg += `\n*${monitorJSON.name}*`;
+ textMsg += `*${monitorJSON.name}*\n`;
}
- textMsg += `\n${msg}`;
+ textMsg += `${msg}`;
const baseURL = await setting("primaryBaseURL");
if (baseURL) {