summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--packages/backend/src/core/entities/NoteEntityService.ts9
1 files changed, 4 insertions, 5 deletions
diff --git a/packages/backend/src/core/entities/NoteEntityService.ts b/packages/backend/src/core/entities/NoteEntityService.ts
index 9a59da4349..66dbb66167 100644
--- a/packages/backend/src/core/entities/NoteEntityService.ts
+++ b/packages/backend/src/core/entities/NoteEntityService.ts
@@ -177,10 +177,9 @@ export class NoteEntityService implements OnModuleInit {
const reaction = _hint_.myReactions.get(noteId);
if (reaction) {
return this.reactionService.convertLegacyReaction(reaction.reaction);
- } else if (reaction === null) {
+ } else {
return undefined;
}
- // 実装上抜けがあるだけかもしれないので、「ヒントに含まれてなかったら(=undefinedなら)return」のようにはしない
}
// パフォーマンスのためノートが作成されてから2秒以上経っていない場合はリアクションを取得しない
@@ -387,11 +386,11 @@ export class NoteEntityService implements OnModuleInit {
const renoteIds = notes.filter(n => n.renoteId != null).map(n => n.renoteId!);
// パフォーマンスのためノートが作成されてから2秒以上経っていない場合はリアクションを取得しない
const oldId = this.idService.gen(Date.now() - 2000);
- const targets = [...notes.filter(n => n.id < oldId).map(n => n.id), ...renoteIds];
- const myReactions = await this.noteReactionsRepository.findBy({
+ const targets = [...notes.filter(n => (n.id < oldId) && (Object.keys(n.reactions).length > 0)).map(n => n.id), ...renoteIds];
+ const myReactions = targets.length > 0 ? await this.noteReactionsRepository.findBy({
userId: meId,
noteId: In(targets),
- });
+ }) : [];
for (const target of targets) {
myReactionsMap.set(target, myReactions.find(reaction => reaction.noteId === target) ?? null);