mirror of
https://github.com/mattermost/mattermost.git
synced 2025-02-25 18:55:24 -06:00
Sorted channel suggestions be type before sorting by name
This commit is contained in:
@@ -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') {
|
||||
|
||||
Reference in New Issue
Block a user