From a453b9f7d6ada354a007352526ee636b3baa3d62 Mon Sep 17 00:00:00 2001 From: Timothee Groleau Date: Thu, 4 Apr 2024 11:20:10 +0800 Subject: [PATCH] fix: remove unecessary join and site retrieval (#1268) --- src/services/identity/NotificationsService.ts | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/src/services/identity/NotificationsService.ts b/src/services/identity/NotificationsService.ts index fa4261c4c..695e9a810 100644 --- a/src/services/identity/NotificationsService.ts +++ b/src/services/identity/NotificationsService.ts @@ -228,6 +228,7 @@ class NotificationsService { const recentTargetNotification = await this.repository.findOne({ where: { user_id: siteMember.userId, + site_id: siteMember.siteId, type: notificationType, created_at: { [Op.gte]: getNotificationExpiryDate(notificationType), @@ -235,16 +236,6 @@ class NotificationsService { link, source_username: notificationSourceUsername, }, - include: [ - { - model: Site, - as: "site", - required: true, - where: { - id: siteMember.siteId, - }, - }, - ], }) if (recentTargetNotification) {