From 0e882d0bed66274d261108618e0a50601081967e Mon Sep 17 00:00:00 2001 From: Shailesh Baldaniya Date: Tue, 3 Aug 2021 10:39:36 +0530 Subject: [PATCH] Fix Chat Transfer Failure due to Unrecognized stage name departmentId --- app/models/server/models/Users.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/models/server/models/Users.js b/app/models/server/models/Users.js index fbe0bcfc0b3b..956c1ce52363 100644 --- a/app/models/server/models/Users.js +++ b/app/models/server/models/Users.js @@ -219,7 +219,7 @@ export class Users extends Base { // if department is provided, remove the agents that are not from the selected department const departmentFilter = departmentId ? [{ $lookup: { - from: 'rocketchat_livechat_department_agent', + from: 'rocketchat_livechat_department_agents', let: { departmentId: '$departmentId', agentId: '$agentId' }, pipeline: [{ $match: { $expr: { $eq: ['$$agentId', '$_id'] } }, @@ -273,7 +273,7 @@ export class Users extends Base { }, }, }, - ...customFilter ? [customFilter] : [], + ...customFilter ? [{ $match: customFilter }] : [], { $sort: { 'queueInfo.chats': 1,