From b3950a22d9f93ed032431e397652cfe9b0edb089 Mon Sep 17 00:00:00 2001 From: Tiago Evangelista Pinto Date: Thu, 8 Jul 2021 13:53:36 -0300 Subject: [PATCH] replace findOneOnlineAgentByUserName for findOneOnlineAgentByUserList --- .../server/hooks/handleNextAgentPreferredEvents.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ee/app/livechat-enterprise/server/hooks/handleNextAgentPreferredEvents.js b/ee/app/livechat-enterprise/server/hooks/handleNextAgentPreferredEvents.js index 42f180d270f4..79addc40ad5a 100644 --- a/ee/app/livechat-enterprise/server/hooks/handleNextAgentPreferredEvents.js +++ b/ee/app/livechat-enterprise/server/hooks/handleNextAgentPreferredEvents.js @@ -15,7 +15,7 @@ const normalizeDefaultAgent = (agent) => { return { agentId, username }; }; -const getDefaultAgent = (username) => username && normalizeDefaultAgent(Users.findOneOnlineAgentByUsername(username, { fields: { _id: 1, username: 1 } })); +const getDefaultAgent = (username) => username && normalizeDefaultAgent(Users.findOneOnlineAgentByUserList(username, { fields: { _id: 1, username: 1 } })); const checkDefaultAgentOnNewRoom = (defaultAgent, defaultGuest) => { if (defaultAgent || !defaultGuest) { @@ -49,7 +49,7 @@ const checkDefaultAgentOnNewRoom = (defaultAgent, defaultGuest) => { } const { servedBy: { username: usernameByRoom } } = room; - const lastRoomAgent = normalizeDefaultAgent(Users.findOneOnlineAgentByUsername(usernameByRoom, { fields: { _id: 1, username: 1 } })); + const lastRoomAgent = normalizeDefaultAgent(Users.findOneOnlineAgentByUserList(usernameByRoom, { fields: { _id: 1, username: 1 } })); return lastRoomAgent || defaultAgent; };