Skip to content

Commit 22e2324

Browse files
committed
if (notes.length === 0) return;
1 parent 6be1d98 commit 22e2324

File tree

3 files changed

+4
-6
lines changed

3 files changed

+4
-6
lines changed

packages/backend/src/core/NoteReadService.ts

+2
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,8 @@ export class NoteReadService implements OnApplicationShutdown {
8888
userId: MiUser['id'],
8989
notes: (MiNote | Packed<'Note'>)[],
9090
): Promise<void> {
91+
if (notes.length === 0) return;
92+
9193
const readMentions: (MiNote | Packed<'Note'>)[] = [];
9294
const readSpecifiedNotes: (MiNote | Packed<'Note'>)[] = [];
9395

packages/backend/src/core/entities/NotificationEntityService.ts

+1-3
Original file line numberDiff line numberDiff line change
@@ -237,9 +237,7 @@ export class NotificationEntityService implements OnModuleInit {
237237
}
238238
return acc;
239239
}, new Set<Packed<'Note'>>());
240-
if (notesToRead.size > 0) {
241-
trackPromise(this.noteReadService.read(meId, Array.from(notesToRead)));
242-
}
240+
trackPromise(this.noteReadService.read(meId, Array.from(notesToRead)));
243241
} catch (e) {
244242
// console.error('error thrown by NoteReadService.read', e);
245243
}

packages/backend/src/server/api/endpoints/antennas/notes.ts

+1-3
Original file line numberDiff line numberDiff line change
@@ -124,9 +124,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
124124
notes.sort((a, b) => a.id > b.id ? -1 : 1);
125125
}
126126

127-
if (notes.length > 0) {
128-
this.noteReadService.read(me.id, notes);
129-
}
127+
this.noteReadService.read(me.id, notes);
130128

131129
return await this.noteEntityService.packMany(notes, me);
132130
});

0 commit comments

Comments
 (0)