packed noteがmapなのでそちらを使う
This commit is contained in:
parent
7753124ec1
commit
6b45b814c9
|
@ -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);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue