server: fixup sql

Fixup to 0b7c9095bf.
This commit is contained in:
Johann150 2023-01-02 00:11:35 +01:00
parent 0fbd7fa492
commit 7f564431be
Signed by untrusted user: Johann150
GPG key ID: 9EE6577A2A06F8F1

View file

@ -103,8 +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) })
// don't show users twice, but also make sure there is at least one value otherwise this is an invalid query
.andWhere('user.id NOT IN (:...ids)', { ids: users.length === 0 ? [''] : users.map(user => user.id) })
.andWhere(new Brackets(qb => { qb
.where('user.updatedAt IS NULL')
.orWhere('user.updatedAt > :activeThreshold', { activeThreshold });