From 7f564431bee3d2476acb5c45ef0df11b07863d89 Mon Sep 17 00:00:00 2001 From: Johann150 Date: Mon, 2 Jan 2023 00:11:35 +0100 Subject: [PATCH] server: fixup sql Fixup to 0b7c9095bf96254a4ac0b4488b223088bd078612. --- packages/backend/src/server/api/endpoints/users/search.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/backend/src/server/api/endpoints/users/search.ts b/packages/backend/src/server/api/endpoints/users/search.ts index 0e861bdc2..02e58cf75 100644 --- a/packages/backend/src/server/api/endpoints/users/search.ts +++ b/packages/backend/src/server/api/endpoints/users/search.ts @@ -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 });