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

Code before:
                    text: {
                        type: "plain_text",
                        text: "Visit site",
                    },
                    value: "Site",
                    url: new URL(address),
                });
            } catch (e) {
                log.debug("slack", `Failed to parse address ${address} as URL`);
            }
        }

        return actions;
    }

    /**
     * Builds the different blocks the Slack message consists of.
     * @param {string} baseURL Uptime Kuma base URL
     * @param {object} monitorJSON The monitor object
     * @param {object} heartbeatJSON The heartbeat object
     * @param {string} title The message title
     * @param {string} msg The message body
     * @param {boolean} includeGroupName Whether to include group name in the message
     * @returns {Array<object>} The rich content blocks for the Slack message
     */
    buildBlocks(baseURL, monitorJSON, heartbeatJSON, title, msg, includeGroupName = false) {
        //create an array to dynamically add blocks
        const blocks = [];

        // the header block
        blocks.push({
            type: "header",
            text: {
                type: "plain_text",
                text: title,
            },
        });

        // Optional context line for monitor group path (excluding monitor name)
        if (includeGroupName) {
            const groupPath = monitorJSON?.path?.length > 1 ? monitorJSON.path.slice(0, -1).join(" / ") : "";
            if (groupPath) {
                blocks.push({
                    type: "context",
                    elements: [
                        {
                            type: "mrkdwn",
                            text: `_${groupPath}_`,
                        },
                    ],
                });

Review comment (suggestion):
```suggestion
    buildBlocks(baseURL, monitorJSON, heartbeatJSON, title, msg, includeGroupName) {
```

Code after:
                    text: {
                        type: "plain_text",
                        text: "Visit site",
                    },
                    value: "Site",
                    url: new URL(address),
                });
            } catch (e) {
                log.debug("slack", `Failed to parse address ${address} as URL`);
            }
        }

        return actions;
    }

    /**
     * Builds the different blocks the Slack message consists of.
     * @param {string} baseURL Uptime Kuma base URL
     * @param {object} monitorJSON The monitor object
     * @param {object} heartbeatJSON The heartbeat object
     * @param {string} title The message title
     * @param {string} msg The message body
     * @param {boolean} includeGroupName Whether to include group name in the message
     * @returns {Array<object>} The rich content blocks for the Slack message
     */
    buildBlocks(baseURL, monitorJSON, heartbeatJSON, title, msg, includeGroupName) {
        //create an array to dynamically add blocks
        const blocks = [];

        // the header block
        blocks.push({
            type: "header",
            text: {
                type: "plain_text",
                text: title,
            },
        });

        // Optional context line for monitor group path (excluding monitor name)
        if (includeGroupName) {
            const groupPath = monitorJSON?.path?.length > 1 ? monitorJSON.path.slice(0, -1).join(" / ") : "";
            if (groupPath) {
                blocks.push({
                    type: "context",
                    elements: [
                        {
                            type: "mrkdwn",
                            text: `_${groupPath}_`,
                        },
                    ],
                });