server: don't return users twice in search
All checks were successful
ci/woodpecker/push/lint-client Pipeline was successful
ci/woodpecker/push/lint-foundkey-js Pipeline was successful
ci/woodpecker/push/build Pipeline was successful
ci/woodpecker/push/lint-backend Pipeline was successful
ci/woodpecker/push/lint-sw Pipeline was successful
ci/woodpecker/push/test Pipeline was successful
All checks were successful
ci/woodpecker/push/lint-client Pipeline was successful
ci/woodpecker/push/lint-foundkey-js Pipeline was successful
ci/woodpecker/push/build Pipeline was successful
ci/woodpecker/push/lint-backend Pipeline was successful
ci/woodpecker/push/lint-sw Pipeline was successful
ci/woodpecker/push/test Pipeline was successful
This commit is contained in:
parent
338e898f56
commit
0b7c9095bf
1 changed files with 3 additions and 1 deletions
|
@ -64,7 +64,7 @@ export default define(meta, paramDef, async (ps, me) => {
|
|||
.getMany();
|
||||
} else {
|
||||
const nameQuery = Users.createQueryBuilder('user')
|
||||
.where(new Brackets(qb => {
|
||||
.where(new Brackets(qb => {
|
||||
qb.where('user.name ILIKE :query', { query: '%' + ps.query + '%' });
|
||||
|
||||
// Also search username if it qualifies as username
|
||||
|
@ -103,6 +103,8 @@ export default define(meta, paramDef, async (ps, me) => {
|
|||
|
||||
const query = Users.createQueryBuilder('user')
|
||||
.where(`user.id IN (${ profQuery.getQuery() })`)
|
||||
// don't show users twice
|
||||
.andWhere('user.id NOT IN (:...ids)', { ids: users.map(user => user.id) })
|
||||
.andWhere(new Brackets(qb => { qb
|
||||
.where('user.updatedAt IS NULL')
|
||||
.orWhere('user.updatedAt > :activeThreshold', { activeThreshold });
|
||||
|
|
Loading…
Reference in a new issue