diff options
| author | Hazelnoot <acomputerdog@gmail.com> | 2025-06-05 02:34:57 -0400 |
|---|---|---|
| committer | Hazelnoot <acomputerdog@gmail.com> | 2025-06-05 02:34:57 -0400 |
| commit | 05d7aa0b91525e9029b1e8a638561bf125ca32cb (patch) | |
| tree | d4010119294e5ebfdd89d4c0b9543541a88d2bdd /packages/backend/src/server/api/endpoints/notes/local-timeline.ts | |
| parent | fix performance regression in mentions endpoint (diff) | |
| download | sharkey-05d7aa0b91525e9029b1e8a638561bf125ca32cb.tar.gz sharkey-05d7aa0b91525e9029b1e8a638561bf125ca32cb.tar.bz2 sharkey-05d7aa0b91525e9029b1e8a638561bf125ca32cb.zip | |
additional fixes and cleanup to all note endpoints
Diffstat (limited to 'packages/backend/src/server/api/endpoints/notes/local-timeline.ts')
| -rw-r--r-- | packages/backend/src/server/api/endpoints/notes/local-timeline.ts | 27 |
1 files changed, 12 insertions, 15 deletions
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 360528eaed..41b1ee1086 100644 --- a/packages/backend/src/server/api/endpoints/notes/local-timeline.ts +++ b/packages/backend/src/server/api/endpoints/notes/local-timeline.ts @@ -168,8 +168,17 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint- .innerJoinAndSelect('note.user', 'user') .leftJoinAndSelect('note.reply', 'reply') .leftJoinAndSelect('note.renote', 'renote') - .leftJoinAndSelect('reply.user', 'replyUser', 'replyUser.id = note.replyUserId') - .leftJoinAndSelect('renote.user', 'renoteUser', 'renoteUser.id = note.renoteUserId'); + .leftJoinAndSelect('reply.user', 'replyUser') + .leftJoinAndSelect('renote.user', 'renoteUser') + .limit(ps.limit); + + if (!ps.withReplies) { + query + // 1. Not a reply, 2. a self-reply + .andWhere(new Brackets(qb => qb + .orWhere('note.replyId IS NULL') // 返信ではない + .orWhere('note.replyUserId = note.userId'))); + } this.queryService.generateBlockedHostQueryForNote(query); this.queryService.generateSilencedUserQueryForNotes(query, me); @@ -190,18 +199,6 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint- this.queryService.generateMutedUserRenotesQueryForNotes(query, me); } - 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'); - })); - })); - } - - return await query.limit(ps.limit).getMany(); + return await query.getMany(); } } |