diff --git a/apps/meteor/server/models/raw/Messages.ts b/apps/meteor/server/models/raw/Messages.ts index bec0afaafe43..4736758afbb6 100644 --- a/apps/meteor/server/models/raw/Messages.ts +++ b/apps/meteor/server/models/raw/Messages.ts @@ -1,3 +1,4 @@ +import { OtrSystemMessagesValues } from '@rocket.chat/core-typings'; import type { ILivechatDepartment, IMessage, @@ -30,7 +31,6 @@ import type { } from 'mongodb'; import { BaseRaw } from './BaseRaw'; -import { otrSystemMessages } from '../../../app/otr/lib/constants'; import { readSecondaryPreferred } from '../../database/readSecondaryPreferred'; type DeepWritable = T extends (...args: any) => any @@ -699,12 +699,7 @@ export class MessagesRaw extends BaseRaw implements IMessagesModel { const query: Filter = { rid: roomId, t: { - $in: [ - 'otr', - otrSystemMessages.USER_JOINED_OTR, - otrSystemMessages.USER_REQUESTED_OTR_KEY_REFRESH, - otrSystemMessages.USER_KEY_REFRESHED_SUCCESSFULLY, - ], + $in: ['otr', ...OtrSystemMessagesValues], }, ts: { $lte: ts }, }; diff --git a/packages/core-typings/src/IMessage/IMessage.ts b/packages/core-typings/src/IMessage/IMessage.ts index ab2eee721d46..d5a2ee518d32 100644 --- a/packages/core-typings/src/IMessage/IMessage.ts +++ b/packages/core-typings/src/IMessage/IMessage.ts @@ -62,7 +62,7 @@ const LivechatMessageTypesValues = [ const OtrMessageTypeValues = ['otr', 'otr-ack'] as const; -const OtrSystemMessagesValues = ['user_joined_otr', 'user_requested_otr_key_refresh', 'user_key_refreshed_successfully'] as const; +export const OtrSystemMessagesValues = ['user_joined_otr', 'user_requested_otr_key_refresh', 'user_key_refreshed_successfully'] as const; export type OtrSystemMessages = (typeof OtrSystemMessagesValues)[number]; const MessageTypes = [