Repository: louislam/uptime-kuma
File: server/notification-providers/slack.js (JavaScript)

Code before:
                return okMsg;
            }

            const baseURL = await setting("primaryBaseURL");

            // Check if templating is enabled
            if (notification.slackUseTemplate) {
                const renderedText = await this.renderTemplate(
                    notification.slackTemplate,
                    msg,
                    monitorJSON,
                    heartbeatJSON
                );

                let data = {
                    text: renderedText,
                    channel: notification.slackchannel,
                    username: notification.slackusername,
                    icon_emoji: notification.slackiconemo,
                };

                await axios.post(notification.slackwebhookURL, data, config);
                return okMsg;
            }

            const includeGroupName = notification.slackIncludeGroupName || false;
            const groupPath =
                includeGroupName && monitorJSON?.path?.length > 1 ? monitorJSON.path.slice(0, -1).join(" / ") : "";

            const title = monitorJSON?.name || "Uptime Kuma Alert";
            let data = {
                text: msg,
                channel: notification.slackchannel,
                username: notification.slackusername,
                icon_emoji: notification.slackiconemo,
                attachments: [],
            };

            if (notification.slackrichmessage) {
                data.attachments.push({
                    color: heartbeatJSON["status"] === UP ? "#2eb886" : "#e01e5a",
                    blocks: this.buildBlocks(baseURL, monitorJSON, heartbeatJSON, title, msg),
                });
            } else {
                // Include group name in plain text messages if enabled
                if (includeGroupName && groupPath) {
                    data.text = `_${groupPath}_\n${title}\n${msg}`;
                } else {
                    data.text = `${title}\n${msg}`;
                }
            }

Review comment (suggestion):
Previous default.
Please also default this way on the frontend.

```suggestion
            const includeGroupName = notification.slackIncludeGroupName || true;
```

Code after:
                return okMsg;
            }

            const baseURL = await setting("primaryBaseURL");

            // Check if templating is enabled
            if (notification.slackUseTemplate) {
                const renderedText = await this.renderTemplate(
                    notification.slackTemplate,
                    msg,
                    monitorJSON,
                    heartbeatJSON
                );

                let data = {
                    text: renderedText,
                    channel: notification.slackchannel,
                    username: notification.slackusername,
                    icon_emoji: notification.slackiconemo,
                };

                await axios.post(notification.slackwebhookURL, data, config);
                return okMsg;
            }

            const includeGroupName = notification.slackIncludeGroupName ?? true;

            const groupPath =
                includeGroupName && monitorJSON?.path?.length > 1 ? monitorJSON.path.slice(0, -1).join(" / ") : "";

            const title = monitorJSON?.name || "Uptime Kuma Alert";
            let data = {
                text: msg,
                channel: notification.slackchannel,
                username: notification.slackusername,
                icon_emoji: notification.slackiconemo,
                attachments: [],
            };

            if (notification.slackrichmessage) {
                data.attachments.push({
                    color: heartbeatJSON["status"] === UP ? "#2eb886" : "#e01e5a",
                    blocks: this.buildBlocks(baseURL, monitorJSON, heartbeatJSON, title, msg, includeGroupName),
                });
            } else {
                // Include group name in plain text messages if enabled
                if (includeGroupName && groupPath) {
                    data.text = `_${groupPath}_\n${title}\n${msg}`;
                } else {
                    data.text = `${title}\n${msg}`;
                }