feat(slack): Add option to include monitor group name in notifications#6835
Conversation
|
Hello and thanks for lending a paw to Uptime Kuma! 🐻👋 |
…nsy1998/uptime-kuma into fix_monitor_group_name_1_28
|
@imclint21. |
CommanderStorm
left a comment
There was a problem hiding this comment.
LGTM with one change to how this defaults.
Please post screenshots of how these features interact so that I am sure that you have tested all combinations 😉
I think these are the code paths that are relevant:
- rich messages true/false + groups true/false + templates false (=> 4 screenshots)
- templates true (=> one additional screenshot)
| * @returns {Array<object>} The rich content blocks for the Slack message | ||
| */ | ||
| buildBlocks(baseURL, monitorJSON, heartbeatJSON, title, msg) { | ||
| buildBlocks(baseURL, monitorJSON, heartbeatJSON, title, msg, includeGroupName = false) { |
There was a problem hiding this comment.
| buildBlocks(baseURL, monitorJSON, heartbeatJSON, title, msg, includeGroupName = false) { | |
| buildBlocks(baseURL, monitorJSON, heartbeatJSON, title, msg, includeGroupName) { |
| return okMsg; | ||
| } | ||
|
|
||
| const includeGroupName = notification.slackIncludeGroupName || false; |
There was a problem hiding this comment.
Previous default.
Please also default this way on the frontend.
| const includeGroupName = notification.slackIncludeGroupName || false; | |
| const includeGroupName = notification.slackIncludeGroupName || true; |
|
Hi, @CommanderStorm. |
| const includeGroupName = | ||
| notification.slackIncludeGroupName === true || notification.slackIncludeGroupName === "true"; |
There was a problem hiding this comment.
Not sure why this is done this way.
I think you mean this, right?
| const includeGroupName = | |
| notification.slackIncludeGroupName === true || notification.slackIncludeGroupName === "true"; | |
| const includeGroupName = notification.slackIncludeGroupName ?? true; |
Also, please set this default in the frontend.
To do this, check how other notification providers do this in the mounted hook.
|
@dovansy1998 congrats on your first contribution to Uptime Kuma! 🐻 |





Summary
In this pull request, the following changes are made:
Backend (
server/notification-providers/slack.js)includeGroupNameparameter tobuildBlocks()method to conditionally display monitor group path in rich messagessend()method to:slackUseTemplateis enabledslackIncludeGroupNameis enabledFrontend (
src/components/notifications/Slack.vue)TemplatedTextareacomponent for template editingResolves #6467
Details
### Please follow this checklist to avoid unnecessary back and forth (click to expand)Screenshots for Visual Changes