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

16 lines
524 B

Meteor.methods
channelsList: (filter, limit, sort) ->
options = { fields: { name: 1 }, sort: { msgs:-1 } }
if _.isNumber limit
options.limit = limit
if _.trim(sort)
switch sort
when 'name'
options.sort = { name: 1 }
when 'msgs'
options.sort = { msgs: -1 }
if filter
return { channels: RocketChat.models.Rooms.findByNameContainingAndTypes(filter, ['c'], options).fetch() }
else
return { channels: RocketChat.models.Rooms.findByTypeAndArchivationState('c', false, options).fetch() }