diff options
-rw-r--r-- | web/react/components/search_autocomplete.jsx | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/web/react/components/search_autocomplete.jsx b/web/react/components/search_autocomplete.jsx index 736919697..260cbd7bf 100644 --- a/web/react/components/search_autocomplete.jsx +++ b/web/react/components/search_autocomplete.jsx @@ -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') { |