Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 10 additions & 7 deletions server/methods/canAccessRoom.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,15 @@ Meteor.methods

room = ChatRoom.findOne rid, { fields: { usernames: 1, t: 1, name: 1 } }

if room.t is 'c'
canAccess = true
else if room.usernames.indexOf(user.username) isnt -1
canAccess = true
if room
if room.t is 'c'
canAccess = true
else if room.usernames.indexOf(user.username) isnt -1
canAccess = true

if canAccess isnt true
return false
if canAccess isnt true
return false
else
return _.pick room, ['_id', 't', 'name']
else
return _.pick room, ['_id', 't', 'name']
throw new Meteor.Error 'invalid-room', '[methods] canAccessRoom -> Room ID is invalid'