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/createChannel.coffee

37 lines
604 B

Meteor.methods
createChannel: (name, members) ->
fromId = Meteor.userId()
# console.log '[methods] createChannel -> '.green, 'fromId:', fromId, 'members:', members
now = new Date()
members.push Meteor.userId()
name = s.slugify name
# create new room
roomId = ChatRoom.insert
uids: members
ts: now
t: 'c'
uid: Meteor.userId()
name: name
msgs: 0
for user in members
sub =
uid: user
rid: roomId
ts: now
rn: name
t: 'c'
unread: 0
if user is Meteor.userId()
sub.ls = now
ChatSubscription.insert sub
return {
rid: roomId
}