Skip to content

Commit

Permalink
[NEW] Sorting channels by number of users in directory (#9972)
Browse files Browse the repository at this point in the history
  • Loading branch information
Arun Galva authored and ggazzo committed Jul 18, 2018
1 parent 7cb8918 commit 4441f31
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions server/methods/browseChannels.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ const sortUsers = function(field, direction) {
}
};


Meteor.methods({
browseChannels({text = '', type = 'channels', sortBy = 'name', sortDirection = 'asc', page = 0, limit = 10}) {
const regex = new RegExp(s.trim(s.escapeRegExp(text)), 'i');
Expand All @@ -35,7 +34,8 @@ Meteor.methods({
return;
}

if (!['name', 'createdAt', ...type === 'channels' ? ['usersCount'] : [], ...type === 'users' ? ['username'] : []].includes(sortBy)) {

if (!['name', 'createdAt', 'usersCount', ...type === 'channels' ? ['usernames'] : [], ...type === 'users' ? ['username'] : []].includes(sortBy)) {
return;
}

Expand Down

0 comments on commit 4441f31

Please sign in to comment.