From 5a906bebc4563cdd126bf6cc4b520238315d467f Mon Sep 17 00:00:00 2001 From: Kevin Aleman Date: Tue, 17 Oct 2023 07:43:52 -0600 Subject: [PATCH] Update apps/meteor/app/livechat/server/api/lib/users.ts Co-authored-by: Murtaza Patrawala <34130764+murtaza98@users.noreply.github.com> --- apps/meteor/app/livechat/server/api/lib/users.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/apps/meteor/app/livechat/server/api/lib/users.ts b/apps/meteor/app/livechat/server/api/lib/users.ts index 2fc947f9ca458..66d9d091c262b 100644 --- a/apps/meteor/app/livechat/server/api/lib/users.ts +++ b/apps/meteor/app/livechat/server/api/lib/users.ts @@ -46,6 +46,8 @@ async function findUsers({ if (!showIdleAgents) { const oldOr = query.$or; + const newOr = [{ status: { $exists: true, $ne: 'offline' }, roles: { $ne: 'bot' } }, { roles: 'bot' }]; + if (oldOr) { delete query.$or; Object.assign(query, { @@ -54,13 +56,13 @@ async function findUsers({ $or: oldOr, }, { - $or: [{ status: { $exists: true, $ne: 'offline' }, roles: { $ne: 'bot' } }, { roles: 'bot' }], + $or: newOr, }, ], }); } else { Object.assign(query, { - $or: [{ status: { $exists: true, $ne: 'offline' }, roles: { $ne: 'bot' } }, { roles: 'bot' }], + $or: newOr, }); } }