The communications platform that puts data protection first.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
Rocket.Chat/server/methods/findOrCreateRoom.coffee

13 lines
545 B

Meteor.methods
findOrCreateClientRoomThenJoin: (clientId, usernames) ->
m = clientId.match(/^(?:CLT){0,1}([0-9]+)/i);
roomName = m[0];
if not roomName?
throw new Meteor.Error 403, '[methods] findOrCreateClientRoom -> Mal-format'
room = RocketChat.models.Rooms.findOneByName(roomName);
console.log '[methods] findOrCreateClientRoom -> '.green, 'userId:', Meteor.userId(), 'arguments:', arguments
if not room?
room = Meteor.call('createPrivateGroup', roomName, Meteor.userId(), usernames)
Meteor.call 'joinRoom', room._id