test if we have usernames on rooms (#11216)

pull/11224/head
Guilherme Gazzo 8 years ago committed by Rodrigo Nascimento
parent b267686398
commit 59157ce50c
  1. 2
      packages/rocketchat-ui/client/views/app/directory.js
  2. 30
      server/methods/browseChannels.js

@ -14,7 +14,7 @@ function directorySearch(config, cb) {
if (config.type === 'channels') {
return {
name: result.name,
users: result.usernames.length,
users: (result.usernames ? result.usernames.length : result.usersCount) || 0,
createdAt: timeAgo(result.ts),
lastMessage: result.lastMessage && timeAgo(result.lastMessage.ts),
description: result.description,

@ -56,19 +56,23 @@ Meteor.methods({
return;
}
return {
results: RocketChat.models.Rooms.findByNameAndType(regex, 'c', {
...options,
sort,
fields: {
description: 1,
topic: 1,
name: 1,
lastMessage: 1,
ts: 1,
archived: 1,
usernames: 1
}
}).fetch(),
results: RocketChat.models.Rooms.findByNameAndType(
regex,
'c',
{
...options,
sort,
fields: {
description: 1,
topic: 1,
name: 1,
lastMessage: 1,
ts: 1,
archived: 1,
usernames: 1,
usersCount: 1
}
}).fetch(),
total: RocketChat.models.Rooms.findByNameAndType(regex, 'c').count()
};
}

Loading…
Cancel
Save