Sorted channels by name if their display_name is equal (#3607)

Этот коммит содержится в:
Harrison Healey
2016-07-18 11:11:28 -04:00
коммит произвёл Joram Wilander
родитель c0ab2636d6
Коммит 80726bde82

Просмотреть файл

@@ -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);
}