packed noteがmapなのでそちらを使う

This commit is contained in:
tamaina 2024-02-21 18:44:11 +00:00
parent 7753124ec1
commit 6b45b814c9
1 changed files with 5 additions and 4 deletions

View File

@ -230,13 +230,14 @@ export class NotificationEntityService implements OnModuleInit {
if (markNotesAsRead) { if (markNotesAsRead) {
try { 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) { 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; return acc;
}, new Set<MiNote['id']>()); }, new Set<Packed<'Note'>>());
trackPromise(this.noteReadService.read(meId, notes.filter(x => noteIdsToRead.has(x.id)))); trackPromise(this.noteReadService.read(meId, Array.from(notesToRead)));
} catch (e) { } catch (e) {
// console.error('error thrown by NoteReadService.read', e); // console.error('error thrown by NoteReadService.read', e);
} }