From a310cee715cc39396b22a81f4202bb6963cfc661 Mon Sep 17 00:00:00 2001 From: Hazelnoot Date: Wed, 22 Oct 2025 22:34:37 -0400 Subject: [PATCH] remove unused withRepliesToSelf option from users/notes endpoint --- packages/backend/src/misc/is-reply.ts | 8 ++++--- .../src/server/api/endpoints/users/notes.ts | 21 ++++++------------- 2 files changed, 11 insertions(+), 18 deletions(-) diff --git a/packages/backend/src/misc/is-reply.ts b/packages/backend/src/misc/is-reply.ts index 980eae11c9..1405f38d01 100644 --- a/packages/backend/src/misc/is-reply.ts +++ b/packages/backend/src/misc/is-reply.ts @@ -3,8 +3,10 @@ * SPDX-License-Identifier: AGPL-3.0-only */ -import { MiUser } from '@/models/User.js'; +import type { MiNote } from '@/models/Note.js'; +import type { MiUser } from '@/models/User.js'; -export function isReply(note: any, viewerId?: MiUser['id'] | undefined | null): boolean { - return note.replyId && note.replyUserId !== note.userId && note.replyUserId !== viewerId; +// Should really be named "isReplyToOther" +export function isReply(note: MiNote, viewerId?: MiUser['id'] | undefined | null): boolean { + return note.replyId != null && note.replyUserId !== note.userId && note.replyUserId !== viewerId; } diff --git a/packages/backend/src/server/api/endpoints/users/notes.ts b/packages/backend/src/server/api/endpoints/users/notes.ts index 0bb78f87fb..3297c45215 100644 --- a/packages/backend/src/server/api/endpoints/users/notes.ts +++ b/packages/backend/src/server/api/endpoints/users/notes.ts @@ -64,7 +64,6 @@ export const paramDef = { properties: { userId: { type: 'string', format: 'misskey:id' }, withReplies: { type: 'boolean', default: false }, - withRepliesToSelf: { type: 'boolean', default: true }, withQuotes: { type: 'boolean', default: true }, withRenotes: { type: 'boolean', default: true }, withBots: { type: 'boolean', default: true }, @@ -123,8 +122,7 @@ export default class extends Endpoint { // eslint- withQuotes: ps.withQuotes, withBots: ps.withBots, withNonPublic: ps.withNonPublic, - withRepliesToOthers: ps.withReplies, - withRepliesToSelf: ps.withRepliesToSelf, + withReplies: ps.withReplies, }, me); return await this.noteEntityService.packMany(timeline, me); @@ -153,9 +151,6 @@ export default class extends Endpoint { // eslint- excludeBots: !ps.withBots, noteFilter: note => { if (note.channel?.isSensitive && !isSelf) return false; - - // These are handled by DB fallback, but we duplicate them here in case a timeline was already populated with notes - if (!ps.withRepliesToSelf && note.reply?.userId === note.userId) return false; if (!ps.withQuotes && isRenote(note) && isQuote(note)) return false; if (!ps.withNonPublic && note.visibility !== 'public') return false; @@ -172,8 +167,7 @@ export default class extends Endpoint { // eslint- withQuotes: ps.withQuotes, withBots: ps.withBots, withNonPublic: ps.withNonPublic, - withRepliesToOthers: ps.withReplies, - withRepliesToSelf: ps.withRepliesToSelf, + withReplies: ps.withReplies, }, me), }); @@ -192,8 +186,7 @@ export default class extends Endpoint { // eslint- withQuotes: boolean, withBots: boolean, withNonPublic: boolean, - withRepliesToOthers: boolean, - withRepliesToSelf: boolean, + withReplies: boolean, }, me: MiLocalUser | null) { const isSelf = me && (me.id === ps.userId); @@ -237,12 +230,10 @@ export default class extends Endpoint { // eslint- this.queryService.andIsNotQuote(query, 'note'); } - if (!ps.withRepliesToOthers && !ps.withRepliesToSelf) { - query.andWhere('reply.id IS NULL'); - } else if (!ps.withRepliesToOthers) { + if (ps.withReplies) { this.queryService.generateExcludedRepliesQueryForNotes(query, me); - } else if (!ps.withRepliesToSelf) { - query.andWhere('(reply.id IS NULL OR reply."userId" != note."userId")'); + } else { + query.andWhere('note.replyId IS NULL'); } if (!ps.withNonPublic) {