From 93d3501c907945a875453ed974955c22377aa272 Mon Sep 17 00:00:00 2001 From: anatawa12 Date: Thu, 19 Oct 2023 17:29:09 +0900 Subject: [PATCH] fix: replies are included even if withReplies = false in local timeline (#12074) --- .../src/server/api/endpoints/notes/local-timeline.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/packages/backend/src/server/api/endpoints/notes/local-timeline.ts b/packages/backend/src/server/api/endpoints/notes/local-timeline.ts index 9d5688f96..3b6c93fdf 100644 --- a/packages/backend/src/server/api/endpoints/notes/local-timeline.ts +++ b/packages/backend/src/server/api/endpoints/notes/local-timeline.ts @@ -163,6 +163,18 @@ export default class extends Endpoint { // eslint- query.andWhere('note.fileIds != \'{}\''); } + if (!ps.withReplies) { + query.andWhere(new Brackets(qb => { + qb + .where('note.replyId IS NULL') // 返信ではない + .orWhere(new Brackets(qb => { + qb // 返信だけど投稿者自身への返信 + .where('note.replyId IS NOT NULL') + .andWhere('note.replyUserId = note.userId'); + })); + })); + } + const timeline = await query.limit(ps.limit).getMany(); process.nextTick(() => {