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/publications/channelAutocomplete.coffee

25 lines
644 B

Meteor.publish 'channelAutocomplete', (name) ->
unless this.userId
return this.ready()
console.log '[publish] channelAutocomplete -> '.green, name
pub = this
options =
fields:
_id: 1
name: 1
limit: 5
cursorHandle = RocketChat.models.Rooms.findByNameContainingAndTypes(name, ['c'], options).observeChanges
added: (_id, record) ->
pub.added('channel-autocomplete', _id, record) if _id?
changed: (_id, record) ->
pub.changed('channel-autocomplete', _id, record) if _id?
removed: (_id, record) ->
pub.removed('channel-autocomplete', _id, record) if _id?
@ready()
@onStop ->
cursorHandle.stop()
return