Fix Utils importing in ChannelStore. (#5503)

This fixes a whole load of bugs around Channel Members Modals, and
elsewhere where the Channel Members are used. Most of those bugs have
been alreay closed as "Cannot Reproduce" becaues the issue was a really
nasty race condition in the javascript!
Этот коммит содержится в:
George Goldberg
2017-02-23 02:33:13 +00:00
коммит произвёл Corey Hulen
родитель 9f65284ba1
Коммит 7883a515e7

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

@@ -7,6 +7,7 @@ import EventEmitter from 'events';
import TeamStore from 'stores/team_store.jsx';
import UserStore from 'stores/user_store.jsx';
var ChannelUtils;
var Utils;
import {ActionTypes, Constants} from 'utils/constants.jsx';
import {isSystemMessage} from 'utils/post_utils.jsx';
@@ -204,11 +205,11 @@ class ChannelStoreClass extends EventEmitter {
channels.push(channel);
}
if (!Utils) {
Utils = require('utils/channel_utils.jsx'); //eslint-disable-line global-require
if (!ChannelUtils) {
ChannelUtils = require('utils/channel_utils.jsx'); //eslint-disable-line global-require
}
channels = channels.sort(Utils.sortChannelsByDisplayName);
channels = channels.sort(ChannelUtils.sortChannelsByDisplayName);
this.storeChannels(channels);
}
@@ -286,11 +287,11 @@ class ChannelStoreClass extends EventEmitter {
getMoreChannelsList(teamId = TeamStore.getCurrentId()) {
const teamChannels = this.moreChannels[teamId] || {};
if (!Utils) {
Utils = require('utils/channel_utils.jsx'); //eslint-disable-line global-require
if (!ChannelUtils) {
ChannelUtils = require('utils/channel_utils.jsx'); //eslint-disable-line global-require
}
return Object.keys(teamChannels).map((cid) => teamChannels[cid]).sort(Utils.sortChannelsByDisplayName);
return Object.keys(teamChannels).map((cid) => teamChannels[cid]).sort(ChannelUtils.sortChannelsByDisplayName);
}
storeStats(stats) {