Skip to content

Commit

Permalink
[FIX] Exception in getSingleMessage (#12970)
Browse files Browse the repository at this point in the history
* fixed the fuckfuck

ok

* do the doing
  • Loading branch information
Tsuki authored and rodrigok committed Dec 19, 2018
1 parent 1243125 commit 52e9bb7
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions packages/rocketchat-lib/server/methods/getSingleMessage.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,13 @@ Meteor.methods({

const msg = RocketChat.models.Messages.findOneById(msgId);

if (!msg && !msg.rid) {
if (!msg || !msg.rid) {
return undefined;
}

Meteor.call('canAccessRoom', msg.rid, Meteor.userId());
if (!Meteor.call('canAccessRoom', msg.rid, Meteor.userId())) {
throw new Meteor.Error('error-not-allowed', 'Not allowed', { method: 'getSingleMessage' });
}

return msg;
},
Expand Down

0 comments on commit 52e9bb7

Please sign in to comment.