From d25114cba3f407d8bf5bc2900fd60b70ae4ee7ca Mon Sep 17 00:00:00 2001 From: Tom Moor Date: Wed, 26 Mar 2025 23:34:51 -0400 Subject: [PATCH] perf --- server/models/helpers/NotificationHelper.ts | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/server/models/helpers/NotificationHelper.ts b/server/models/helpers/NotificationHelper.ts index 15189bb733..2d374677b9 100644 --- a/server/models/helpers/NotificationHelper.ts +++ b/server/models/helpers/NotificationHelper.ts @@ -60,13 +60,7 @@ export default class NotificationHelper { comment: Comment, actorId: string ): Promise => { - let recipients = await this.getDocumentNotificationRecipients({ - document, - notificationType: NotificationEventType.CreateComment, - actorId, - // We will check below, this just prevents duplicate queries - disableAccessCheck: true, - }); + let recipients: User[]; // If this is a reply to another comment, we want to notify all users // that are involved in the thread of this comment (i.e. the original @@ -109,6 +103,14 @@ export default class NotificationHelper { recipients = recipients.filter((recipient) => recipient.subscribedToEventType(NotificationEventType.CreateComment) ); + } else { + recipients = await this.getDocumentNotificationRecipients({ + document, + notificationType: NotificationEventType.CreateComment, + actorId, + // We will check below, this just prevents duplicate queries + disableAccessCheck: true, + }); } const filtered: User[] = [];