Skip to content

Commit

Permalink
Merged branch livechat-crm-integration-improvements into livechat-crm…
Browse files Browse the repository at this point in the history
…-integration-improvements
  • Loading branch information
sampaiodiego committed Aug 4, 2016
2 parents 0c77432 + 0169727 commit 741cde7
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 11 deletions.
1 change: 0 additions & 1 deletion packages/rocketchat-livechat/app/.meteor/dev_bundle

This file was deleted.

4 changes: 0 additions & 4 deletions packages/rocketchat-livechat/app/client/views/messages.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ Template.messages.helpers({
});
},
showOptions() {
console.log('show ->', Template.instance().showOptions.get());
if (Template.instance().showOptions.get()) {
return 'show';
} else {
Expand Down Expand Up @@ -52,7 +51,6 @@ Template.messages.events({
return $(event.currentTarget).removeClass('show');
},
'click .toggle-options': function(event, instance) {
// Blaze.render(Template.options, $('.livechat-room').get(0));
instance.showOptions.set(!instance.showOptions.get());
}
});
Expand All @@ -76,8 +74,6 @@ Template.messages.onCreated(function() {
};

$(document).click((/*event*/) => {
console.log('showOptions.get() ->', this.showOptions.get());

if (!this.showOptions.get()) {
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ Template.visitorEdit.events({
roomData.topic = event.currentTarget.elements['topic'].value;
roomData.tags = event.currentTarget.elements['tags'].value;

Meteor.call('livechat:saveLivechatInfo', userData, roomData, (err) => {
Meteor.call('livechat:saveInfo', userData, roomData, (err) => {
if (err) {
toastr.error(t(err.error));
} else {
Expand Down
2 changes: 1 addition & 1 deletion packages/rocketchat-livechat/package.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,8 @@ Package.onUse(function(api) {
api.addFiles('server/methods/removeTrigger.js', 'server');
api.addFiles('server/methods/saveCustomField.js', 'server');
api.addFiles('server/methods/saveDepartment.js', 'server');
api.addFiles('server/methods/saveInfo.js', 'server');
api.addFiles('server/methods/saveIntegration.js', 'server');
api.addFiles('server/methods/saveLivechatInfo.js', 'server');
api.addFiles('server/methods/saveSurveyFeedback.js', 'server');
api.addFiles('server/methods/saveTrigger.js', 'server');
api.addFiles('server/methods/searchAgent.js', 'server');
Expand Down
2 changes: 1 addition & 1 deletion packages/rocketchat-livechat/server/hooks/sendToCRM.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,6 @@ RocketChat.callbacks.add('livechat.closeRoom', (room) => {
return sendToCRM('closeRoom', room);
});

RocketChat.callbacks.add('livechat.saveLivechatInfo', (room) => {
RocketChat.callbacks.add('livechat.saveInfo', (room) => {
return sendToCRM('saveLivechatInfo', room);
});
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/* eslint new-cap: [2, {"capIsNewExceptions": ["Match.ObjectIncluding", "Match.Optional"]}] */

Meteor.methods({
'livechat:saveLivechatInfo': function(guestData, roomData) {
'livechat:saveInfo': function(guestData, roomData) {
if (!Meteor.userId() || !RocketChat.authz.hasPermission(Meteor.userId(), 'view-l-room')) {
throw new Meteor.Error('error-not-allowed', 'Not allowed', { method: 'livechat:saveLivechatInfo' });
throw new Meteor.Error('error-not-allowed', 'Not allowed', { method: 'livechat:saveInfo' });
}

check(guestData, Match.ObjectIncluding({
Expand All @@ -22,7 +22,7 @@ Meteor.methods({
const ret = RocketChat.Livechat.saveGuest(guestData) && RocketChat.Livechat.saveRoomInfo(roomData, guestData);

Meteor.defer(() => {
RocketChat.callbacks.run('livechat.saveLivechatInfo', RocketChat.models.Rooms.findOneById(roomData._id));
RocketChat.callbacks.run('livechat.saveInfo', RocketChat.models.Rooms.findOneById(roomData._id));
});

return ret;
Expand Down

0 comments on commit 741cde7

Please sign in to comment.