Add getUsersOfRoom

pull/4275/head
Rodrigo Nascimento 10 years ago
parent 6d36d95f1c
commit f9382ba3f8
No known key found for this signature in database
GPG Key ID: 2C85B3AFE75D23F9
  1. 14
      server/methods/getUsersOfRoom.js

@ -0,0 +1,14 @@
Meteor.methods({
getUsersOfRoom(roomId) {
if (!Meteor.userId()) {
throw new Meteor.Error('error-invalid-user', 'Invalid user', { method: 'getUsersOfRoom' });
}
const room = Meteor.call('canAccessRoom', roomId, Meteor.userId());
if (!room) {
throw new Meteor.Error('error-invalid-room', 'Invalid room', { method: 'getUsersOfRoom' });
}
return RocketChat.cache.Rooms.findByIndex('_id', roomId).usernames;
}
});
Loading…
Cancel
Save