Skip to content

Commit

Permalink
[FIX] Opening a Livechat room from another agent (#13951)
Browse files Browse the repository at this point in the history
  • Loading branch information
renatobecker authored and sampaiodiego committed Apr 2, 2019
1 parent 982ed73 commit 727170e
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/livechat/server/startup.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { callbacks } from '../../callbacks';
import { settings } from '../../settings';

Meteor.startup(() => {
roomTypes.setRoomFind('l', (_id) => Rooms.findLivechatById(_id).fetch());
roomTypes.setRoomFind('l', (_id) => Rooms.findOneLivechatById(_id));

addRoomAccessValidator(function(room, user) {
return room && room.t === 'l' && user && hasPermission(user._id, 'view-livechat-rooms');
Expand Down
15 changes: 15 additions & 0 deletions app/models/server/models/Rooms.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,21 @@ export class Rooms extends Base {
return this.find(query, options);
}

findOneLivechatById(_id, fields) {
const options = {};

if (fields) {
options.fields = fields;
}

const query = {
t: 'l',
_id,
};

return this.findOne(query, options);
}

findLivechatByIdAndVisitorToken(_id, visitorToken, fields) {
const options = {};

Expand Down

0 comments on commit 727170e

Please sign in to comment.