Registrations currently disabled due to spam. Contact me externally if you need an account

Commit 8202b5a8 authored by Gabriel Engel's avatar Gabriel Engel Committed by GitHub
Browse files

Merge pull request #5241 from RocketChat/livechat-fix-take-inquiry

Fix livechat take inquiry after removing username fields from rooms
parents ec97de83 077023b1
Loading
Loading
Loading
Loading
+1 −3
Original line number Diff line number Diff line
@@ -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
+1 −2
Original line number Diff line number Diff line
@@ -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