diff options
Diffstat (limited to 'web/react/stores')
-rw-r--r-- | web/react/stores/channel_store.jsx | 24 |
1 files changed, 5 insertions, 19 deletions
diff --git a/web/react/stores/channel_store.jsx b/web/react/stores/channel_store.jsx index 64aaeb329..cc0d0d14b 100644 --- a/web/react/stores/channel_store.jsx +++ b/web/react/stores/channel_store.jsx @@ -4,6 +4,7 @@ var AppDispatcher = require('../dispatcher/app_dispatcher.jsx'); var EventEmitter = require('events').EventEmitter; +var Utils; var Constants = require('../utils/constants.jsx'); var ActionTypes = Constants.ActionTypes; @@ -183,26 +184,11 @@ class ChannelStoreClass extends EventEmitter { channels.push(channel); } - channels.sort((a, b) => { - let channelADisplayName = ''; - let channelBDisplayName = ''; - - if (a && a.display_name) { - channelADisplayName = a.display_name.toLowerCase(); - } - if (b && b.display_name) { - channelBDisplayName = b.display_name.toLowerCase(); - } - - if (channelADisplayName < channelBDisplayName) { - return -1; - } - if (channelADisplayName > channelBDisplayName) { - return 1; - } - return 0; - }); + if (!Utils) { + Utils = require('../utils/utils.jsx'); //eslint-disable-line global-require + } + channels.sort(Utils.sortByDisplayName); this.pStoreChannels(channels); } pStoreChannels(channels) { |