From 820e1589aff956af36f69d935d8022b1d819cdfa Mon Sep 17 00:00:00 2001 From: syuilo Date: Sat, 21 Mar 2020 20:14:26 +0900 Subject: [PATCH] Fix #6110 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updatedAt が null なユーザーは検索に出てこなくなる副作用あり --- src/server/api/endpoints/users/search-by-username-and-host.ts | 3 +++ src/server/api/endpoints/users/search.ts | 2 ++ 2 files changed, 5 insertions(+) diff --git a/src/server/api/endpoints/users/search-by-username-and-host.ts b/src/server/api/endpoints/users/search-by-username-and-host.ts index bc68f4409..b6ba09d0c 100644 --- a/src/server/api/endpoints/users/search-by-username-and-host.ts +++ b/src/server/api/endpoints/users/search-by-username-and-host.ts @@ -72,6 +72,7 @@ export default define(meta, async (ps, me) => { q.andWhere('user.usernameLower like :username', { username: ps.username.toLowerCase() + '%' }) } + q.andWhere('user.updatedAt IS NOT NULL'); q.orderBy('user.updatedAt', 'DESC'); const users = await q.take(ps.limit!).skip(ps.offset).getMany(); @@ -82,6 +83,7 @@ export default define(meta, async (ps, me) => { .where('user.host IS NULL') .andWhere('user.isSuspended = FALSE') .andWhere('user.usernameLower like :username', { username: ps.username.toLowerCase() + '%' }) + .andWhere('user.updatedAt IS NOT NULL') .orderBy('user.updatedAt', 'DESC') .take(ps.limit!) .skip(ps.offset) @@ -92,6 +94,7 @@ export default define(meta, async (ps, me) => { .where('user.host IS NOT NULL') .andWhere('user.isSuspended = FALSE') .andWhere('user.usernameLower like :username', { username: ps.username.toLowerCase() + '%' }) + .andWhere('user.updatedAt IS NOT NULL') .orderBy('user.updatedAt', 'DESC') .take(ps.limit! - users.length) .getMany(); diff --git a/src/server/api/endpoints/users/search.ts b/src/server/api/endpoints/users/search.ts index c01f355d8..7733b1a6b 100644 --- a/src/server/api/endpoints/users/search.ts +++ b/src/server/api/endpoints/users/search.ts @@ -74,6 +74,7 @@ export default define(meta, async (ps, me) => { .where('user.host IS NULL') .andWhere('user.isSuspended = FALSE') .andWhere('user.usernameLower like :username', { username: ps.query.replace('@', '').toLowerCase() + '%' }) + .andWhere('user.updatedAt IS NOT NULL') .orderBy('user.updatedAt', 'DESC') .take(ps.limit!) .skip(ps.offset) @@ -84,6 +85,7 @@ export default define(meta, async (ps, me) => { .where('user.host IS NOT NULL') .andWhere('user.isSuspended = FALSE') .andWhere('user.usernameLower like :username', { username: ps.query.replace('@', '').toLowerCase() + '%' }) + .andWhere('user.updatedAt IS NOT NULL') .orderBy('user.updatedAt', 'DESC') .take(ps.limit! - users.length) .getMany();