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/stream/messages.coffee

33 lines
831 B

@msgStream = new Meteor.Stream 'messages'
msgStream.permissions.write (eventName) ->
console.log('stream.permissions.write', this.userId);
# return eventName == 'send' && this.userId;
return false
msgStream.permissions.read (eventName) ->
console.log('stream.permissions.read', this.userId, eventName);
# return this.userId == eventName;
try
canAccess = Meteor.call 'canAccessRoom', eventName, this.userId
return false if not canAccess
return true
catch e
return false
Meteor.startup ->
options = {}
if not RocketChat.settings.get 'Message_ShowEditedStatus'
options.fields = { ets: 0 }
RocketChat.models.Messages.findVisibleCreatedOrEditedAfterTimestamp(new Date(), options).observe
added: (record) ->
msgStream.emit record.rid, record
changed: (record) ->
msgStream.emit record.rid, record