-
-
Notifications
You must be signed in to change notification settings - Fork 5.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: remove service name/type from discord notifier #5181
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I should have been more clear in my previous comment.
The extraction is what I wanted, but the URL should be added if the value for them exists. This is still a valuable context.
I have left two other comments below.
Not quite sure about ping given that this will only show on up pings..
What do you think about this?
}, | ||
{ | ||
name: "Error", | ||
value: heartbeatJSON["msg"] == null ? "N/A" : heartbeatJSON["msg"], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's use this instead
value: heartbeatJSON["msg"] == null ? "N/A" : heartbeatJSON["msg"], | |
value: msg, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Scratch that. Looking at #5181 (comment) this looks bad (👀).
The original author had a point..
Let's do the following instead:
value: heartbeatJSON["msg"] == null ? "N/A" : heartbeatJSON["msg"], | |
value: heartbeatJSON["msg"] ?? msg, |
7ca5150
to
af230ba
Compare
I made a mess trying to clean up that conflict. Sort of expected it to apply easier... (and then I force pushed because it was the last thing I ran so I had to do it again :() I think it makes sense to exclude it if myredis is redis |
b620a02
to
8b82520
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks pretty good. Could basically merged, except for a few nits.
Because we have had problems with this in the past and the codepath is different for that:
Could you post a screenshot of a UP
notifcation to ensure that you have tested this? ^^
PSA: force pushing looses the state the reviewer was in => reviewiers cannot review "from the last review" => unless being asked to, merging is almost always better. ^^
The PR will likely be squashed at the end anyway.
<a | ||
href="https://discord.com/developers/docs/resources/webhook#create-webhook" | ||
target="_blank" | ||
>{{ $t("withADiscordBot") }}</a> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this might be simpler for our translators
<a | |
href="https://discord.com/developers/docs/resources/webhook#create-webhook" | |
target="_blank" | |
>{{ $t("withADiscordBot") }}</a> | |
<template #webhookWithADiscordBotAPI> | |
<a | |
href="https://discord.com/developers/docs/resources/webhook#create-webhook" | |
target="_blank" | |
>{{ $t("webhookWithADiscordBotAPI") }}</a> | |
</template> |
await axios.post(webhookUrl.toString(), discordupdata); | ||
return okMsg; | ||
} | ||
} catch (error) { | ||
console.log(error); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if it is not already done so, it should be logged for all and using our log.error
facities.
If this is the case, that would be for another PR.
console.log(error); |
|
||
const baseURL = await Settings.get("primaryBaseURL"); | ||
const address = this.extractAddress(monitorJSON); | ||
const hasAddress = address !== "" && address !== monitorJSON.hostname; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why != monitorJSON.hostname
?
As far as I can remeber, none of the other monitors do that => lets also not do this, unless there is a reason for this.
If there is no particular reason, please inline hasAddress
.
If there is, please add a comment why.
@@ -4,6 +4,12 @@ | |||
<input id="discord-webhook-url" v-model="$parent.notification.discordWebhookUrl" type="text" class="form-control" required autocomplete="false"> | |||
<div class="form-text"> | |||
{{ $t("wayToGetDiscordURL") }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lets add a line break here, to prevent those lines being mushed together (think this adresses It's a little cursed
from #5181 (comment))
{{ $t("wayToGetDiscordURL") }} | |
{{ $t("wayToGetDiscordURL") }}<br> |
"wayToGetDiscordURLEnhanced": "Using the Discord API, you may also create the webhook {0} for button support.", | ||
"withADiscordBot": "with a bot", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This word order reads a bit nicer in my mind. What do you think?
"wayToGetDiscordURLEnhanced": "Using the Discord API, you may also create the webhook {0} for button support.", | |
"withADiscordBot": "with a bot", | |
"wayToGetDiscordURLEnhanced": "For button support, you need to create create {webhookWithADiscordBotAPI}.", | |
"webhookWithADiscordBotAPI": "the webhook with a bot using the Discord API", |
}, | ||
{ | ||
name: "Error", | ||
value: msg, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
value: msg, | |
value: heartbeatJSON["msg"] ?? msg, |
https://github.com/louislam/uptime-kuma/blob/master/CONTRIBUTING.md#can-i-create-a-pull-request-for-uptime-kuma
Tick the checkbox if you understand [x]:
Description
Fixes #3327, closes #4495.
To do this, I have fully removed the Service Name/Service Type field from the Discord notifier embed. As discussed in the #4495 PR, no other monitor has a distinction between
Service Type
andService URL
. In alignment with the same comment, I've also moved the fields to their own variable so we are not maintaining two versions of the fields array.I'd also like to use this PR to discuss reformatting the Discord embed entirely? In my opinion, repeating the service name so close to each other makes the embed look bad. Additionally, we repeat the time of the outage in an embed field and the embed footer.
Type of change
Checklist
Screenshots
Current (and the issue I aim to fix):
Proposed: