diff options
Diffstat (limited to 'web/react/components/search_autocomplete.jsx')
-rw-r--r-- | web/react/components/search_autocomplete.jsx | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/web/react/components/search_autocomplete.jsx b/web/react/components/search_autocomplete.jsx index 736919697..d245c6bac 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') { @@ -289,7 +298,7 @@ export default class SearchAutocomplete extends React.Component { key='public-channel-divider' className='search-autocomplete__divider' > - {'Public ' + Utils.getChannelTerm(Constants.OPEN_CHANNEL) + 's'} + <span>{'Public ' + Utils.getChannelTerm(Constants.OPEN_CHANNEL) + 's'}</span> </div> ); suggestions = suggestions.concat(publicChannels.map(this.renderChannelSuggestion)); @@ -302,7 +311,7 @@ export default class SearchAutocomplete extends React.Component { key='private-channel-divider' className='search-autocomplete__divider' > - {'Private ' + Utils.getChannelTerm(Constants.PRIVATE_CHANNEL) + 's'} + <span>{'Private ' + Utils.getChannelTerm(Constants.PRIVATE_CHANNEL) + 's'}</span> </div> ); suggestions = suggestions.concat(privateChannels.map(this.renderChannelSuggestion)); |