if (notes.length === 0) return;
This commit is contained in:
parent
6be1d986cd
commit
22e2324f96
|
@ -88,6 +88,8 @@ export class NoteReadService implements OnApplicationShutdown {
|
||||||
userId: MiUser['id'],
|
userId: MiUser['id'],
|
||||||
notes: (MiNote | Packed<'Note'>)[],
|
notes: (MiNote | Packed<'Note'>)[],
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
|
if (notes.length === 0) return;
|
||||||
|
|
||||||
const readMentions: (MiNote | Packed<'Note'>)[] = [];
|
const readMentions: (MiNote | Packed<'Note'>)[] = [];
|
||||||
const readSpecifiedNotes: (MiNote | Packed<'Note'>)[] = [];
|
const readSpecifiedNotes: (MiNote | Packed<'Note'>)[] = [];
|
||||||
|
|
||||||
|
|
|
@ -237,9 +237,7 @@ export class NotificationEntityService implements OnModuleInit {
|
||||||
}
|
}
|
||||||
return acc;
|
return acc;
|
||||||
}, new Set<Packed<'Note'>>());
|
}, new Set<Packed<'Note'>>());
|
||||||
if (notesToRead.size > 0) {
|
trackPromise(this.noteReadService.read(meId, Array.from(notesToRead)));
|
||||||
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);
|
||||||
}
|
}
|
||||||
|
|
|
@ -124,9 +124,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
||||||
notes.sort((a, b) => a.id > b.id ? -1 : 1);
|
notes.sort((a, b) => a.id > b.id ? -1 : 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (notes.length > 0) {
|
this.noteReadService.read(me.id, notes);
|
||||||
this.noteReadService.read(me.id, notes);
|
|
||||||
}
|
|
||||||
|
|
||||||
return await this.noteEntityService.packMany(notes, me);
|
return await this.noteEntityService.packMany(notes, me);
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue