Этот коммит содержится в:
David Lu
2016-06-04 08:18:23 -07:00
коммит произвёл Joram Wilander
родитель bbaf1032a2
Коммит 06b1646798

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

@@ -40,7 +40,7 @@ export default class MoreChannels extends React.Component {
var initState = getStateFromStores(); var initState = getStateFromStores();
initState.channelType = ''; initState.channelType = '';
initState.joiningChannel = -1; initState.joiningChannel = '';
initState.showNewChannelModal = false; initState.showNewChannelModal = false;
this.state = initState; this.state = initState;
} }
@@ -65,17 +65,17 @@ export default class MoreChannels extends React.Component {
this.setState(newState); this.setState(newState);
} }
} }
handleJoin(channel, channelIndex) { handleJoin(channel) {
this.setState({joiningChannel: channelIndex}); this.setState({joiningChannel: channel.id});
GlobalActions.emitJoinChannelEvent( GlobalActions.emitJoinChannelEvent(
channel, channel,
() => { () => {
$(ReactDOM.findDOMNode(this.refs.modal)).modal('hide'); $(ReactDOM.findDOMNode(this.refs.modal)).modal('hide');
browserHistory.push(Utils.getTeamURLNoOriginFromAddressBar() + '/channels/' + channel.name); browserHistory.push(Utils.getTeamURLNoOriginFromAddressBar() + '/channels/' + channel.name);
this.setState({joiningChannel: -1}); this.setState({joiningChannel: ''});
}, },
(err) => { (err) => {
this.setState({joiningChannel: -1, serverError: err.message}); this.setState({joiningChannel: '', serverError: err.message});
} }
); );
} }
@@ -83,9 +83,9 @@ export default class MoreChannels extends React.Component {
$(ReactDOM.findDOMNode(this.refs.modal)).modal('hide'); $(ReactDOM.findDOMNode(this.refs.modal)).modal('hide');
this.setState({showNewChannelModal: true}); this.setState({showNewChannelModal: true});
} }
createChannelRow(channel, index) { createChannelRow(channel) {
let joinButton; let joinButton;
if (this.state.joiningChannel === index) { if (this.state.joiningChannel === channel.id) {
joinButton = ( joinButton = (
<img <img
className='join-channel-loading-gif' className='join-channel-loading-gif'
@@ -95,7 +95,7 @@ export default class MoreChannels extends React.Component {
} else { } else {
joinButton = ( joinButton = (
<button <button
onClick={this.handleJoin.bind(self, channel, index)} onClick={this.handleJoin.bind(self, channel)}
className='btn btn-primary' className='btn btn-primary'
> >
<FormattedMessage <FormattedMessage