From e4ee8ce8fd3805ab0bf72d3120f570d958fe61b8 Mon Sep 17 00:00:00 2001 From: gabriellsh Date: Wed, 18 Oct 2023 19:59:48 -0300 Subject: [PATCH] fix set --- .../app/lib/server/functions/processWebhookMessage.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/apps/meteor/app/lib/server/functions/processWebhookMessage.ts b/apps/meteor/app/lib/server/functions/processWebhookMessage.ts index bbf61fec6f4b..7529a9cdbaeb 100644 --- a/apps/meteor/app/lib/server/functions/processWebhookMessage.ts +++ b/apps/meteor/app/lib/server/functions/processWebhookMessage.ts @@ -33,6 +33,13 @@ type DefaultValues = { emoji: string; }; +const toArray = (value: string | Array): Array => { + if (typeof value === 'string') { + return [value]; + } + return value; +}; + export const processWebhookMessage = async function ( messageObj: Payload, user: IUser & { username: RequiredField }, @@ -40,7 +47,7 @@ export const processWebhookMessage = async function ( ) { const sentData = []; - const channels: Array = [...new Set(messageObj.channel || messageObj.roomId || defaultValues.channel)]; + const channels: Array = [...new Set(toArray(messageObj.channel || messageObj.roomId || defaultValues.channel))]; for await (const channel of channels) { const channelType = channel[0];