mirror of
https://github.com/louislam/uptime-kuma.git
synced 2025-01-18 18:38:07 +00:00
Globally fix if heartbeatJSON["msg"] is undefined
This commit is contained in:
parent
f32441e2f6
commit
14fffcf06b
1 changed files with 7 additions and 1 deletions
|
@ -1069,7 +1069,13 @@ class Monitor extends BeanModel {
|
||||||
|
|
||||||
for (let notification of notificationList) {
|
for (let notification of notificationList) {
|
||||||
try {
|
try {
|
||||||
await Notification.send(JSON.parse(notification.config), msg, await monitor.toJSON(false), bean.toJSON());
|
// Prevent if the msg is undefined, notifications such as Discord cannot send out.
|
||||||
|
const heartbeatJSON = bean.toJSON();
|
||||||
|
if (!heartbeatJSON["msg"]) {
|
||||||
|
heartbeatJSON["msg"] = "";
|
||||||
|
}
|
||||||
|
|
||||||
|
await Notification.send(JSON.parse(notification.config), msg, await monitor.toJSON(false), heartbeatJSON);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
log.error("monitor", "Cannot send notification to " + notification.name);
|
log.error("monitor", "Cannot send notification to " + notification.name);
|
||||||
log.error("monitor", e);
|
log.error("monitor", e);
|
||||||
|
|
Loading…
Reference in a new issue