mirror of
https://codeberg.org/yeentown/barkey
synced 2024-11-25 18:45: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();
|
||||
} else {
|
||||
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
|
||||
.where('user.updatedAt IS NULL')
|
||||
.orWhere('user.updatedAt > :activeThreshold', { activeThreshold: activeThreshold });
|
||||
|
|
Loading…
Reference in a new issue