🚨Fixed linter warns

pull/4099/head
TheDanniCraft 12 months ago
parent f117342deb
commit 4dc74c42ea

@ -14,9 +14,11 @@ class Discord extends NotificationProvider {
try {
const discordDisplayName = notification.discordUsername || "Uptime Kuma";
var threadQuery = "";
let threadQuery = "";
if (notification.discordChannelType == "postToThread") threadQuery = "?thread_id=" + notification.threadId;
if (notification.discordChannelType === "postToThread") {
threadQuery = "?thread_id=" + notification.threadId;
}
// If heartbeatJSON is null, assume we're testing.
if (heartbeatJSON == null) {
@ -25,7 +27,9 @@ class Discord extends NotificationProvider {
content: msg,
};
if (notification.discordChannelType == "createNewForumPost") discordtestdata.thread_name = notification.postName;
if (notification.discordChannelType === "createNewForumPost") {
discordtestdata.thread_name = notification.postName;
}
await axios.post(notification.discordWebhookUrl + threadQuery, discordtestdata);
return okMsg;
@ -54,9 +58,11 @@ class Discord extends NotificationProvider {
// If heartbeatJSON is not null, we go into the normal alerting loop.
if (heartbeatJSON["status"] === DOWN) {
const discordDisplayName = notification.discordUsername || "Uptime Kuma";
var threadQuery = "";
let threadQuery = "";
if (notification.discordChannelType == "postToThread") threadQuery = "?thread_id=" + notification.threadId;
if (notification.discordChannelType === "postToThread") {
threadQuery = "?thread_id=" + notification.threadId;
}
let discorddowndata = {
username: discordDisplayName,
@ -84,12 +90,14 @@ class Discord extends NotificationProvider {
],
}],
};
if (notification.discordChannelType == "createNewForumPost") discorddowndata.thread_name = notification.postName;
if (notification.discordChannelType === "createNewForumPost") {
discorddowndata.thread_name = notification.postName;
}
if (notification.discordPrefixMessage) {
discorddowndata.content = notification.discordPrefixMessage;
}
await axios.post(notification.discordWebhookUrl, discorddowndata);
await axios.post(notification.discordWebhookUrl + threadQuery, discorddowndata);
return okMsg;
} else if (heartbeatJSON["status"] === UP) {
@ -120,7 +128,9 @@ class Discord extends NotificationProvider {
}],
};
if (notification.discordChannelType == "createNewForumPost") discordupdata.thread_name = notification.postName;
if (notification.discordChannelType === "createNewForumPost") {
discordupdata.thread_name = notification.postName;
}
if (notification.discordPrefixMessage) {
discordupdata.content = notification.discordPrefixMessage;

@ -20,7 +20,7 @@
<div class="mb-3">
<label for="discord-message-type" class="form-label">{{ $t("Select message type") }}</label>
<br>
<select id="discord-message-type" class="form-select" v-model="$parent.notification.discordChannelType">
<select id="discord-message-type" v-model="$parent.notification.discordChannelType" class="form-select">
<option value="normal">{{ $t("Normal Message") }}</option>
<option value="createNewForumPost">{{ $t("Create new forum post") }}</option>
<option value="postToThread">{{ $t("Post to existing thread") }}</option>
@ -42,8 +42,8 @@
</template>
<script>
export default {
mounted(){
mounted() {
this.$parent.notification.discordChannelType = "normal";
}
}
</script>
};
</script>

Loading…
Cancel
Save