diff --git a/server/queues/tasks/CommentUpdatedNotificationsTask.ts b/server/queues/tasks/CommentUpdatedNotificationsTask.ts index 68fb184c6..91239c1b8 100644 --- a/server/queues/tasks/CommentUpdatedNotificationsTask.ts +++ b/server/queues/tasks/CommentUpdatedNotificationsTask.ts @@ -6,6 +6,11 @@ import BaseTask, { TaskPriority } from "./BaseTask"; export default class CommentUpdatedNotificationsTask extends BaseTask { public async perform(event: CommentUpdateEvent) { + const newMentionIds = event.data.newMentionIds; + if (!newMentionIds) { + return; + } + const [document, comment] = await Promise.all([ Document.scope("withCollection").findOne({ where: { @@ -20,7 +25,7 @@ export default class CommentUpdatedNotificationsTask extends BaseTask event.data.newMentionIds.includes(mention.id)); + ).filter((mention) => newMentionIds.includes(mention.id)); const userIdsMentioned: string[] = []; for (const mention of mentions) { diff --git a/server/types.ts b/server/types.ts index f661e6206..9b77db86e 100644 --- a/server/types.ts +++ b/server/types.ts @@ -342,7 +342,7 @@ export type CommentUpdateEvent = BaseEvent & { documentId: string; actorId: string; data: { - newMentionIds: string[]; + newMentionIds?: string[]; }; };