Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
victor committed Sep 5, 2018
1 parent 08dd109 commit 32f2263
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ Template.visitorInfo.events({
'click .archive-room'(event) {
event.preventDefault();

Meteor.call('archiveRoom', this.rid, function(error/*, result*/) {
Meteor.call('archiveRoom', this.rid, function(error) {
if (error) {
console.log(error);
} else {
Expand Down Expand Up @@ -289,13 +289,13 @@ Template.visitorInfo.onCreated(function() {
}

this.autorun(() => {
this.user.set(LivechatVisitor.findOne({ '_id': this.visitorId.get() }));
this.user.set(LivechatVisitor.findOne({ _id: this.visitorId.get() }));

//load guest department
// load guest department
if (this.user.get() && this.user.get().department) {
const sub = this.subscribe('livechat:departments', this.user.get().department);
if (sub.ready()) {
const department = LivechatDepartment.findOne({_id: this.user.get().department});
const department = LivechatDepartment.findOne({ _id: this.user.get().department });
if (department) {
this.department.set(department);
}
Expand Down
10 changes: 5 additions & 5 deletions packages/rocketchat-livechat/client/views/sideNav/livechat.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,16 @@ Template.livechat.helpers({
},

inquiries() {
//load all livechatDepartmentAgents fpr current agent
// load all livechatDepartmentAgents fpr current agent
const departmentAgents = LivechatDepartmentAgents.find({
agentId : Meteor.userId()
agentId : Meteor.userId(),
});

const departmentIds = [];
departmentAgents.forEach((agent) => {
departmentIds.push(agent.departmentId);
});
//also include inquiries without a department
// also include inquiries without a department
if (departmentIds.length) {
departmentIds.push(null);
departmentIds.push('');
Expand All @@ -54,7 +54,7 @@ Template.livechat.helpers({
// get all inquiries of the department
const inqs = LivechatInquiry.find({
department: {
$in: departmentIds
$in: departmentIds,
},
status: 'open',
}, {
Expand Down Expand Up @@ -148,6 +148,6 @@ Template.livechat.onCreated(function() {
}
});

this.subscribe('livechat:inquiry', {status: 'open'});
this.subscribe('livechat:inquiry', { status: 'open' });
this.subscribe('livechat:departmentAgents', null);
});
4 changes: 2 additions & 2 deletions packages/rocketchat-livechat/server/methods/closeInquiry.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ Meteor.methods({
}

// find inquiry corresponding to room
const inquiry = RocketChat.models.LivechatInquiry.findOne({rid});
const inquiry = RocketChat.models.LivechatInquiry.findOne({ rid });

// mark inquiry as open
return RocketChat.models.LivechatInquiry.closeInquiry(inquiry._id);
}
},
});
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ Meteor.methods({
}

return RocketChat.models.LivechatInquiry.find(filter || {}).fetch();
}
},
});
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class LivechatInquiry extends RocketChat.models._Base {
*/
closeInquiry(inquiryId) {
this.update({
'_id': inquiryId
_id: inquiryId,
}, {
$set: { status: 'closed' },
});
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Meteor.publish('livechat:inquiry', function() {
Meteor.publish('livechat:inquiry', function(query) {
if (!this.userId) {
return this.error(new Meteor.Error('error-not-authorized', 'Not authorized', { publish: 'livechat:inquiry' }));
}
Expand All @@ -7,7 +7,5 @@ Meteor.publish('livechat:inquiry', function() {
return this.error(new Meteor.Error('error-not-authorized', 'Not authorized', { publish: 'livechat:inquiry' }));
}

query = query || {};

return RocketChat.models.LivechatInquiry.find(query);
return RocketChat.models.LivechatInquiry.find(query || {});
});

0 comments on commit 32f2263

Please sign in to comment.