Commit abbd6e44 authored by Diego Sampaio's avatar Diego Sampaio

Fix livechat take inquiry after removing username fields from rooms

parent 5c2bc467
......@@ -38,11 +38,9 @@ Meteor.methods({
// update room
const room = RocketChat.models.Rooms.findOneById(inquiry.rid);
const usernames = room.usernames.concat(agent.username);
RocketChat.models.Rooms.changeAgentByRoomId(inquiry.rid, usernames, agent);
RocketChat.models.Rooms.changeAgentByRoomId(inquiry.rid, agent);
room.usernames = usernames;
room.servedBy = {
_id: agent.agentId,
username: agent.username
......
......@@ -166,13 +166,12 @@ RocketChat.models.Rooms.findOpenByAgent = function(userId) {
return this.find(query);
};
RocketChat.models.Rooms.changeAgentByRoomId = function(roomId, newUsernames, newAgent) {
RocketChat.models.Rooms.changeAgentByRoomId = function(roomId, newAgent) {
const query = {
_id: roomId
};
const update = {
$set: {
usernames: newUsernames,
servedBy: {
_id: newAgent.agentId,
username: newAgent.username
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment