From 143296afedcb3b0f2f286974579a68c8d8f5d2be Mon Sep 17 00:00:00 2001 From: kakkokari-gtyih <67428053+kakkokari-gtyih@users.noreply.github.com> Date: Wed, 17 Dec 2025 13:24:07 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20query=E3=81=A8birthday=E3=82=92=E5=90=8C?= =?UTF-8?q?=E6=99=82=E3=81=AB=E5=8F=97=E3=81=91=E4=BB=98=E3=81=91=E3=81=AA?= =?UTF-8?q?=E3=81=84=E3=82=88=E3=81=86=E3=81=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../server/api/endpoints/users/following.ts | 19 +++++++++++++++---- packages/misskey-js/src/autogen/types.ts | 6 ++++-- 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/packages/backend/src/server/api/endpoints/users/following.ts b/packages/backend/src/server/api/endpoints/users/following.ts index 6697e2d09d..fe642a9ddd 100644 --- a/packages/backend/src/server/api/endpoints/users/following.ts +++ b/packages/backend/src/server/api/endpoints/users/following.ts @@ -88,10 +88,21 @@ export const paramDef = { sinceDate: { type: 'integer' }, untilDate: { type: 'integer' }, limit: { type: 'integer', minimum: 1, maximum: 100, default: 10 }, - birthday: { ...birthdaySchema, nullable: true }, - query: { type: 'string', nullable: true }, }, }, + { + oneOf: [{ + type: 'object', + properties: { + query: { type: 'string' }, + }, + }, { + type: 'object', + properties: { + birthday: { ...birthdaySchema, nullable: true }, + }, + }], + }, ], } as const; @@ -151,7 +162,7 @@ export default class extends Endpoint { // eslint- .innerJoinAndSelect('following.followee', 'followee'); // query takes priority over birthday - if (ps.query) { + if ('query' in ps && ps.query != null) { const searchQuery = ps.query; const isUsername = searchQuery.startsWith('@') && !searchQuery.includes(' ') && searchQuery.indexOf('@', 1) === -1; @@ -164,7 +175,7 @@ export default class extends Endpoint { // eslint- qb.orWhere('followee.usernameLower LIKE :username', { username: '%' + sqlLikeEscape(searchQuery.toLowerCase()) + '%' }); } })); - } else if (ps.birthday) { + } else if ('birthday' in ps && ps.birthday != null) { try { const birthday = ps.birthday.substring(5, 10); const birthdayUserQuery = this.userProfilesRepository.createQueryBuilder('user_profile'); diff --git a/packages/misskey-js/src/autogen/types.ts b/packages/misskey-js/src/autogen/types.ts index 254f1bcd73..90e723684f 100644 --- a/packages/misskey-js/src/autogen/types.ts +++ b/packages/misskey-js/src/autogen/types.ts @@ -34848,9 +34848,11 @@ export interface operations { untilDate?: number; /** @default 10 */ limit?: number; + } & ({ + query?: string; + } | { birthday?: string | null; - query?: string | null; - }; + }); }; }; responses: {