mirror of
https://activitypub.software/TransFem-org/Sharkey
synced 2024-12-22 16:30:13 +00:00
fix: ユーザー検索で、クエリがusernameの条件を満たす場合はusernameもLIKE検索するように (#8644)
* Fix #8643 * 部分一致にする
This commit is contained in:
parent
22bb1a1793
commit
b2a5076d14
1 changed files with 8 additions and 1 deletions
|
@ -61,7 +61,14 @@ export default define(meta, paramDef, async (ps, me) => {
|
||||||
.getMany();
|
.getMany();
|
||||||
} else {
|
} else {
|
||||||
const nameQuery = Users.createQueryBuilder('user')
|
const nameQuery = Users.createQueryBuilder('user')
|
||||||
.where('user.name ILIKE :query', { query: '%' + ps.query + '%' })
|
.where(new Brackets(qb => {
|
||||||
|
qb.where('user.name ILIKE :query', { query: '%' + ps.query + '%' });
|
||||||
|
|
||||||
|
// Also search username if it qualifies as username
|
||||||
|
if (Users.validateLocalUsername(ps.query)) {
|
||||||
|
qb.orWhere('user.usernameLower LIKE :username', { username: '%' + ps.query.toLowerCase() + '%' });
|
||||||
|
}
|
||||||
|
}))
|
||||||
.andWhere(new Brackets(qb => { qb
|
.andWhere(new Brackets(qb => { qb
|
||||||
.where('user.updatedAt IS NULL')
|
.where('user.updatedAt IS NULL')
|
||||||
.orWhere('user.updatedAt > :activeThreshold', { activeThreshold: activeThreshold });
|
.orWhere('user.updatedAt > :activeThreshold', { activeThreshold: activeThreshold });
|
||||||
|
|
Loading…
Reference in a new issue