[backend] Fix an edge case where notifications wouldn't load properly

This commit is contained in:
Laura Hausmann 2023-11-22 00:26:50 +01:00
parent 8ecf361870
commit 8fa2bf5dca
No known key found for this signature in database
GPG key ID: D044E84C5BE01605

View file

@ -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(