Skip to content

Commit

Permalink
Fix incoming livechat when impersonating an agent
Browse files Browse the repository at this point in the history
  • Loading branch information
sampaiodiego committed Jan 11, 2018
1 parent 21d5b67 commit 21692df
Showing 1 changed file with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import LivechatVisitors from '../models/LivechatVisitors';

Meteor.methods({
sendMessageLivechat({ token, _id, rid, msg }, agent) {
sendMessageLivechat({ token, _id, rid, msg }, desiredAgent) {
check(token, String);
check(_id, String);
check(rid, String);
Expand All @@ -20,6 +20,15 @@ Meteor.methods({
throw new Meteor.Error('invalid-token');
}

let agent;

if (desiredAgent) {
agent = {
agentId: desiredAgent._id,
username: desiredAgent.username
};
}

return RocketChat.Livechat.sendMessage({
guest,
message: {
Expand Down

0 comments on commit 21692df

Please sign in to comment.