From 6b45b814c95553609bf8ae5123827ecb3298e089 Mon Sep 17 00:00:00 2001 From: tamaina Date: Wed, 21 Feb 2024 18:44:11 +0000 Subject: [PATCH] =?UTF-8?q?packed=20note=E3=81=8Cmap=E3=81=AA=E3=81=AE?= =?UTF-8?q?=E3=81=A7=E3=81=9D=E3=81=A1=E3=82=89=E3=82=92=E4=BD=BF=E3=81=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/core/entities/NotificationEntityService.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/packages/backend/src/core/entities/NotificationEntityService.ts b/packages/backend/src/core/entities/NotificationEntityService.ts index fc8881324b..e10b68df02 100644 --- a/packages/backend/src/core/entities/NotificationEntityService.ts +++ b/packages/backend/src/core/entities/NotificationEntityService.ts @@ -230,13 +230,14 @@ export class NotificationEntityService implements OnModuleInit { if (markNotesAsRead) { try { - const noteIdsToRead = validNotifications.reduce((acc, x) => { + const notesToRead = validNotifications.reduce((acc, x) => { if (MARK_NOTE_READ_NOTIFICATION_TYPES.has(x.type) && 'noteId' in x) { - acc.add(x.noteId); + const note = packedNotes.get(x.noteId); + if (note) acc.add(note); } return acc; - }, new Set()); - trackPromise(this.noteReadService.read(meId, notes.filter(x => noteIdsToRead.has(x.id)))); + }, new Set>()); + trackPromise(this.noteReadService.read(meId, Array.from(notesToRead))); } catch (e) { // console.error('error thrown by NoteReadService.read', e); }