From 67b075bf5ba2ecacd1186983501e09f96c9a1729 Mon Sep 17 00:00:00 2001 From: Marcos Defendi Date: Fri, 15 Sep 2023 07:36:09 -0300 Subject: [PATCH] chore: dispatch new event on send system message through svc --- apps/meteor/server/services/messages/service.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/apps/meteor/server/services/messages/service.ts b/apps/meteor/server/services/messages/service.ts index 48f7ad42276c..9e1ad23c6c1c 100644 --- a/apps/meteor/server/services/messages/service.ts +++ b/apps/meteor/server/services/messages/service.ts @@ -9,6 +9,8 @@ import { updateMessage } from '../../../app/lib/server/functions/updateMessage'; import { executeSendMessage } from '../../../app/lib/server/methods/sendMessage'; import { executeSetReaction } from '../../../app/reactions/server/setReaction'; import { settings } from '../../../app/settings/server'; +import { broadcastEventToServices } from '../../lib/isRunningMs'; +import { broadcastMessageSentEvent } from '../../modules/watchers/lib/messages'; export class MessageService extends ServiceClassInternal implements IMessageService { protected name = 'message'; @@ -52,7 +54,10 @@ export class MessageService extends ServiceClassInternal implements IMessageServ settings.get('Message_Read_Receipt_Enabled'), extraData, ); - + void broadcastMessageSentEvent({ + id: result.insertedId, + broadcastCallback: (message) => broadcastEventToServices('message.sent', message), + }); return result.insertedId; } }