summaryrefslogtreecommitdiffstats
path: root/web
diff options
context:
space:
mode:
authorhmhealey <harrisonmhealey@gmail.com>2015-11-06 11:51:10 -0500
committerhmhealey <harrisonmhealey@gmail.com>2015-11-06 11:51:10 -0500
commit6ba996a9e25cc2df05fef1fef2e2f6dd8903625c (patch)
treee995ab9eb94fad05ff861a1f0d51a93b865fd903 /web
parentcb1995eac24f4102945ea9735eb89a11c77ebdde (diff)
downloadchat-6ba996a9e25cc2df05fef1fef2e2f6dd8903625c.tar.gz
chat-6ba996a9e25cc2df05fef1fef2e2f6dd8903625c.tar.bz2
chat-6ba996a9e25cc2df05fef1fef2e2f6dd8903625c.zip
Sorted channel suggestions be type before sorting by name
Diffstat (limited to 'web')
-rw-r--r--web/react/components/search_autocomplete.jsx11
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') {