Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/livechat/server/lib/QueueManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export const QueueManager = {
};

let defaultAgent;
if (servedBy && Users.findOneOnlineAgentByUsername(servedBy.username)) {
if (servedBy && Users.findOneOnlineAgentByUserList(servedBy.username)) {
defaultAgent = { agentId: servedBy._id, username: servedBy.username };
}

Expand Down
2 changes: 1 addition & 1 deletion app/livechat/server/lib/RoutingManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export const RoutingManager = {

async delegateInquiry(inquiry, agent, options = {}) {
const { department, rid } = inquiry;
if (!agent || (agent.username && !Users.findOneOnlineAgentByUsername(agent.username) && !allowAgentSkipQueue(agent))) {
if (!agent || (agent.username && !Users.findOneOnlineAgentByUserList(agent.username) && !allowAgentSkipQueue(agent))) {
agent = await this.getNextAgent(department);
}

Expand Down
2 changes: 1 addition & 1 deletion app/livechat/server/lib/routing/External.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class ExternalQueue {
});

if (result && result.data && result.data.username) {
const agent = Users.findOneOnlineAgentByUsername(result.data.username);
const agent = Users.findOneOnlineAgentByUserList(result.data.username);

if (agent) {
return {
Expand Down
2 changes: 1 addition & 1 deletion app/models/server/models/LivechatDepartmentAgents.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ export class LivechatDepartmentAgents extends Base {
return false;
}

const onlineUser = Users.findOneOnlineAgentByUsername(_.pluck(agents, 'username'));
const onlineUser = Users.findOneOnlineAgentByUserList(_.pluck(agents, 'username'));

return Boolean(onlineUser);
}
Expand Down
6 changes: 5 additions & 1 deletion app/models/server/models/Users.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,11 @@ export class Users extends Base {
return this.findOne(query);
}

findOneOnlineAgentByUsername(username, options) { // TODO:: Create class Agent
findOneOnlineAgentByUserList(userList, options) { // TODO:: Create class Agent
const username = {
$in: [].concat(userList),
};

const query = queryStatusAgentOnline({ username });

return this.findOne(query, options);
Expand Down