mirror of
https://github.com/louislam/uptime-kuma.git
synced 2024-12-27 22:49:42 -08:00
Removes ternary operator for Slack channel mention
This commit is contained in:
parent
9825b33ef3
commit
5200e10aab
|
@ -27,14 +27,15 @@ class Slack extends NotificationProvider {
|
||||||
|
|
||||||
async send(notification, msg, monitorJSON = null, heartbeatJSON = null) {
|
async send(notification, msg, monitorJSON = null, heartbeatJSON = null) {
|
||||||
let okMsg = "Sent Successfully.";
|
let okMsg = "Sent Successfully.";
|
||||||
const finalMsg = notification.slackchannelmention
|
|
||||||
? `${msg} <!channel>`
|
if (notification.slackchannelmention) {
|
||||||
: msg;
|
msg += " <!channel>";
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (heartbeatJSON == null) {
|
if (heartbeatJSON == null) {
|
||||||
let data = {
|
let data = {
|
||||||
"text": finalMsg,
|
"text": msg,
|
||||||
"channel": notification.slackchannel,
|
"channel": notification.slackchannel,
|
||||||
"username": notification.slackusername,
|
"username": notification.slackusername,
|
||||||
"icon_emoji": notification.slackiconemo,
|
"icon_emoji": notification.slackiconemo,
|
||||||
|
@ -46,7 +47,7 @@ class Slack extends NotificationProvider {
|
||||||
const time = heartbeatJSON["time"];
|
const time = heartbeatJSON["time"];
|
||||||
const textMsg = "Uptime Kuma Alert";
|
const textMsg = "Uptime Kuma Alert";
|
||||||
let data = {
|
let data = {
|
||||||
"text": `${textMsg}\n${finalMsg}`,
|
"text": `${textMsg}\n${msg}`,
|
||||||
"channel": notification.slackchannel,
|
"channel": notification.slackchannel,
|
||||||
"username": notification.slackusername,
|
"username": notification.slackusername,
|
||||||
"icon_emoji": notification.slackiconemo,
|
"icon_emoji": notification.slackiconemo,
|
||||||
|
@ -65,7 +66,7 @@ class Slack extends NotificationProvider {
|
||||||
"type": "section",
|
"type": "section",
|
||||||
"fields": [{
|
"fields": [{
|
||||||
"type": "mrkdwn",
|
"type": "mrkdwn",
|
||||||
"text": "*Message*\n" + finalMsg,
|
"text": "*Message*\n" + msg,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "mrkdwn",
|
"type": "mrkdwn",
|
||||||
|
|
Loading…
Reference in a new issue