Sorted channel suggestions be type before sorting by name

This commit is contained in:
hmhealey
2015-11-06 11:51:10 -05:00
parent cb1995eac2
commit 6ba996a9e2

View File

@@ -189,7 +189,16 @@ export default class SearchAutocomplete extends React.Component {
channels = channels.filter((channel) => channel.type !== 'D');
}
channels.sort((a, b) => a.name.localeCompare(b.name));
channels.sort((a, b) => {
// put public channels first and then sort alphabebetically
if (a.type === b.type) {
return a.name.localeCompare(b.name);
} else if (a.type === Constants.OPEN_CHANNEL) {
return -1;
}
return 1;
});
suggestions = channels;
} else if (mode === 'users') {