summaryrefslogtreecommitdiffstats
path: root/webapp
diff options
context:
space:
mode:
authorHarrison Healey <harrisonmhealey@gmail.com>2016-07-18 11:11:28 -0400
committerJoram Wilander <jwawilander@gmail.com>2016-07-18 11:11:28 -0400
commit80726bde82e8dcba918a202be9f6c9457df3ee30 (patch)
treee4bd86379c6dcdee91dd5f6a765f69646e7625c5 /webapp
parentc0ab2636d699c8544ce03a58f61b95cfd66ff7ce (diff)
downloadchat-80726bde82e8dcba918a202be9f6c9457df3ee30.tar.gz
chat-80726bde82e8dcba918a202be9f6c9457df3ee30.tar.bz2
chat-80726bde82e8dcba918a202be9f6c9457df3ee30.zip
Sorted channels by name if their display_name is equal (#3607)
Diffstat (limited to 'webapp')
-rw-r--r--webapp/components/sidebar.jsx6
1 files changed, 5 insertions, 1 deletions
diff --git a/webapp/components/sidebar.jsx b/webapp/components/sidebar.jsx
index 161f2fb7d..cd00c65dd 100644
--- a/webapp/components/sidebar.jsx
+++ b/webapp/components/sidebar.jsx
@@ -92,7 +92,7 @@ export default class Sidebar extends React.Component {
const currentUserId = UserStore.getCurrentId();
const channels = Object.assign([], ChannelStore.getAll());
- channels.sort((a, b) => a.display_name.localeCompare(b.display_name));
+ channels.sort(this.sortChannelsByDisplayName);
const publicChannels = channels.filter((channel) => channel.type === Constants.OPEN_CHANNEL);
const privateChannels = channels.filter((channel) => channel.type === Constants.PRIVATE_CHANNEL);
@@ -363,6 +363,10 @@ export default class Sidebar extends React.Component {
}
sortChannelsByDisplayName(a, b) {
+ if (a.display_name === b.display_name) {
+ return a.name.localeCompare(b.name);
+ }
+
return a.display_name.localeCompare(b.display_name);
}