From 8a8dad15eff614adce2874fa048c88bb9c8f3748 Mon Sep 17 00:00:00 2001 From: Tom Moor Date: Tue, 2 Jul 2024 18:03:22 -0400 Subject: [PATCH] fix: newMentionIds no longer always in event data, closes #7186 --- server/queues/tasks/CommentUpdatedNotificationsTask.ts | 7 ++++++- server/types.ts | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) 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[]; }; };