From f2b8e63e94255bdf20551f7dc1ed58e595d34c5c Mon Sep 17 00:00:00 2001 From: abdou6666 Date: Wed, 27 Nov 2024 19:22:14 +0100 Subject: [PATCH 1/2] fix: add console-channel before filtering --- api/src/chat/services/block.service.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/api/src/chat/services/block.service.ts b/api/src/chat/services/block.service.ts index f3fb45f..3f048b4 100644 --- a/api/src/chat/services/block.service.ts +++ b/api/src/chat/services/block.service.ts @@ -12,6 +12,7 @@ import { Attachment } from '@/attachment/schemas/attachment.schema'; import { AttachmentService } from '@/attachment/services/attachment.service'; import EventWrapper from '@/channel/lib/EventWrapper'; import { ContentService } from '@/cms/services/content.service'; +import { CONSOLE_CHANNEL_NAME } from '@/extensions/channels/console/settings'; import { Nlp } from '@/helper/types'; import { I18nService } from '@/i18n/services/i18n.service'; import { LanguageService } from '@/i18n/services/language.service'; @@ -76,7 +77,7 @@ export class BlockService extends BaseService { return ( !b.trigger_channels || b.trigger_channels.length === 0 || - b.trigger_channels.includes(channel) + [...b.trigger_channels, CONSOLE_CHANNEL_NAME].includes(channel) ); }); @@ -607,4 +608,8 @@ export class BlockService extends BaseService { throw new Error('Invalid message format.'); } } + + getCategoryBlocks(categoryId: string) { + return this.repository.model.find({ category: categoryId }); + } } From 6b7b1c9afce877f3a0729dc2f1ba0f3c4bd8cbea Mon Sep 17 00:00:00 2001 From: abdou6666 Date: Wed, 27 Nov 2024 19:30:12 +0100 Subject: [PATCH 2/2] fix: remove extra code --- api/src/chat/services/block.service.ts | 4 ---- 1 file changed, 4 deletions(-) diff --git a/api/src/chat/services/block.service.ts b/api/src/chat/services/block.service.ts index 3f048b4..5251c93 100644 --- a/api/src/chat/services/block.service.ts +++ b/api/src/chat/services/block.service.ts @@ -608,8 +608,4 @@ export class BlockService extends BaseService { throw new Error('Invalid message format.'); } } - - getCategoryBlocks(categoryId: string) { - return this.repository.model.find({ category: categoryId }); - } }