From 8fa2bf5dca541c68b1988e5b46d80655a2303b4b Mon Sep 17 00:00:00 2001 From: Laura Hausmann Date: Wed, 22 Nov 2023 00:26:50 +0100 Subject: [PATCH] [backend] Fix an edge case where notifications wouldn't load properly --- .../backend/src/models/repositories/notification.ts | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/packages/backend/src/models/repositories/notification.ts b/packages/backend/src/models/repositories/notification.ts index 8aea178c9..9c649cc53 100644 --- a/packages/backend/src/models/repositories/notification.ts +++ b/packages/backend/src/models/repositories/notification.ts @@ -163,11 +163,13 @@ export const NotificationRepository = db.getRepository(Notification).extend({ userId: meId, noteId: In(targets), }); - const myRenotes = await Notes.createQueryBuilder('note') - .select('note.renoteId') - .where('note.userId = :meId', { meId }) - .andWhere('note.renoteId IN (:...targets)', { targets }) - .getMany(); + const myRenotes = targets.length > 0 + ? await Notes.createQueryBuilder('note') + .select('note.renoteId') + .where('note.userId = :meId', { meId }) + .andWhere('note.renoteId IN (:...targets)', { targets }) + .getMany() + : []; for (const target of targets) { myReactionsMap.set(