From 49be37008ce3b553d5b96f72fdc71b22e664f464 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Edeg=C3=A5rd?= Date: Wed, 24 Sep 2025 07:55:22 +0000 Subject: [PATCH] Simplified more. The Slack library will remove undefined values when sending the actual request. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Henrik EdegÄrd --- .../src/lib/SlackNotificationProcessor.test.ts | 2 +- plugins/notifications-backend-module-slack/src/lib/util.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/notifications-backend-module-slack/src/lib/SlackNotificationProcessor.test.ts b/plugins/notifications-backend-module-slack/src/lib/SlackNotificationProcessor.test.ts index c970aec7ba..ad4bf01e9f 100644 --- a/plugins/notifications-backend-module-slack/src/lib/SlackNotificationProcessor.test.ts +++ b/plugins/notifications-backend-module-slack/src/lib/SlackNotificationProcessor.test.ts @@ -829,7 +829,7 @@ describe('SlackNotificationProcessor', () => { const calls = (slack.chat.postMessage as jest.Mock).mock.calls; expect(calls).toHaveLength(1); - expect(calls[0][0]).not.toHaveProperty('username'); + expect(calls[0][0].username).toBeUndefined(); }); }); diff --git a/plugins/notifications-backend-module-slack/src/lib/util.ts b/plugins/notifications-backend-module-slack/src/lib/util.ts index 1116218b09..33293ea24f 100644 --- a/plugins/notifications-backend-module-slack/src/lib/util.ts +++ b/plugins/notifications-backend-module-slack/src/lib/util.ts @@ -30,7 +30,7 @@ export function toChatPostMessageArgs(options: { const args: ChatPostMessageArguments = { channel, text: payload.title, - ...(username && { username }), + username, attachments: [ { color: getColor(payload.severity),