Skip to content

Commit

Permalink
Merge pull request #9750 from RocketChat/livechat-general-fixes
Browse files Browse the repository at this point in the history
[FIX] Livechat issues on external queue and lead capture
  • Loading branch information
rodrigok authored Feb 17, 2018
2 parents 4a34938 + d6ce94a commit bbdd802
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 12 deletions.
2 changes: 1 addition & 1 deletion packages/rocketchat-livechat/.app/client/views/register.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ Template.register.events({
token: visitor.getToken(),
name: $name.val(),
email: $email.val(),
department: Livechat.deparment || departmentId
department: Livechat.department || departmentId
};
Meteor.call('livechat:registerGuest', guest, function(error, result) {
if (error != null) {
Expand Down
10 changes: 1 addition & 9 deletions packages/rocketchat-livechat/server/hooks/leadCapture.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,7 @@ function validateMessage(message, room) {
return false;
}

if (!RocketChat.settings.get('Livechat_Facebook_Enabled')) {
return false;
}

// only send the sms by SMS if it is a livechat room with SMS set to true
// message valid only if it is a livechat room
if (!(typeof room.t !== 'undefined' && room.t === 'l' && room.v && room.v.token)) {
return false;
}
Expand All @@ -29,10 +25,6 @@ function validateMessage(message, room) {
}

RocketChat.callbacks.add('afterSaveMessage', function(message, room) {
if (!RocketChat.settings.get('Livechat_webhook_on_capture')) {
return message;
}

if (!validateMessage(message, room)) {
return message;
}
Expand Down
3 changes: 3 additions & 0 deletions packages/rocketchat-livechat/server/hooks/sendToCRM.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,5 +50,8 @@ RocketChat.callbacks.add('livechat.saveInfo', (room) => {
}, RocketChat.callbacks.priority.MEDIUM, 'livechat-send-crm-save-info');

RocketChat.callbacks.add('livechat.leadCapture', (room) => {
if (!RocketChat.settings.get('Livechat_webhook_on_capture')) {
return room;
}
return sendToCRM('LeadCapture', room, false);
}, RocketChat.callbacks.priority.MEDIUM, 'livechat-send-crm-lead-capture');
4 changes: 2 additions & 2 deletions packages/rocketchat-livechat/server/lib/QueueMethods.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ RocketChat.QueueMethods = {

return room;
},
'External'(guest, message, roomInfo) {
return this['Least_Amount'](guest, message, roomInfo); // eslint-disable-line
'External'(guest, message, roomInfo, agent) {
return this['Least_Amount'](guest, message, roomInfo, agent); // eslint-disable-line
}
};

0 comments on commit bbdd802

Please sign in to comment.