diff options
Diffstat (limited to 'web/react/components/more_channels.jsx')
-rw-r--r-- | web/react/components/more_channels.jsx | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/web/react/components/more_channels.jsx b/web/react/components/more_channels.jsx index c4f831c2e..29512b9b7 100644 --- a/web/react/components/more_channels.jsx +++ b/web/react/components/more_channels.jsx @@ -1,12 +1,12 @@ // Copyright (c) 2015 Mattermost, Inc. All Rights Reserved. // See License.txt for license information. -var utils = require('../utils/utils.jsx'); -var client = require('../utils/client.jsx'); -var asyncClient = require('../utils/async_client.jsx'); -var ChannelStore = require('../stores/channel_store.jsx'); -var LoadingScreen = require('./loading_screen.jsx'); -var NewChannelFlow = require('./new_channel_flow.jsx'); +import * as utils from '../utils/utils.jsx'; +import * as client from '../utils/client.jsx'; +import * as AsyncClient from '../utils/async_client.jsx'; +import ChannelStore from '../stores/channel_store.jsx'; +import LoadingScreen from './loading_screen.jsx'; +import NewChannelFlow from './new_channel_flow.jsx'; function getStateFromStores() { return { @@ -31,12 +31,12 @@ export default class MoreChannels extends React.Component { } componentDidMount() { ChannelStore.addMoreChangeListener(this.onListenerChange); - $(ReactDOM.findDOMNode(this.refs.modal)).on('shown.bs.modal', function shown() { - asyncClient.getMoreChannels(true); + $(ReactDOM.findDOMNode(this.refs.modal)).on('shown.bs.modal', () => { + AsyncClient.getMoreChannels(true); }); var self = this; - $(ReactDOM.findDOMNode(this.refs.modal)).on('show.bs.modal', function show(e) { + $(ReactDOM.findDOMNode(this.refs.modal)).on('show.bs.modal', (e) => { var button = e.relatedTarget; self.setState({channelType: $(button).attr('data-channeltype')}); }); @@ -46,22 +46,22 @@ export default class MoreChannels extends React.Component { } onListenerChange() { var newState = getStateFromStores(); - if (!utils.areStatesEqual(newState.channels, this.state.channels)) { + if (!utils.areObjectsEqual(newState.channels, this.state.channels)) { this.setState(newState); } } handleJoin(channel, channelIndex) { this.setState({joiningChannel: channelIndex}); client.joinChannel(channel.id, - function joinSuccess() { + () => { $(ReactDOM.findDOMNode(this.refs.modal)).modal('hide'); - asyncClient.getChannel(channel.id); + AsyncClient.getChannel(channel.id); utils.switchChannel(channel); this.setState({joiningChannel: -1}); - }.bind(this), - function joinFail(err) { + }, + (err) => { this.setState({joiningChannel: -1, serverError: err.message}); - }.bind(this) + } ); } handleNewChannel() { |