diff --git a/src/components/structures/GroupView.js b/src/components/structures/GroupView.js index 2cb791b689..e725483d29 100644 --- a/src/components/structures/GroupView.js +++ b/src/components/structures/GroupView.js @@ -466,6 +466,10 @@ export default React.createClass({ _onGroupMyMembership: function(group) { if (group.groupId !== this.props.groupId) return; + if (group.myMembership === 'leave') { + // Leave settings - the user might have clicked the "Leave" button + this._closeSettings(); + } this.setState({membershipBusy: false}); }, @@ -562,6 +566,10 @@ export default React.createClass({ }, _onCancelClick: function() { + this._closeSettings(); + }, + + _closeSettings() { this.setState({ editing: false, profileForm: null, @@ -678,7 +686,7 @@ export default React.createClass({ _onRejectInviteClick: function() { this.setState({membershipBusy: true}); - this._matrixClient.leaveGroup(this.props.groupId).then(() => { + this._groupStore.leaveGroup().then(() => { // don't reset membershipBusy here: wait for the membership change to come down the sync }).catch((e) => { this.setState({membershipBusy: false}); @@ -692,7 +700,8 @@ export default React.createClass({ _onJoinClick: function() { this.setState({membershipBusy: true}); - this._matrixClient.joinGroup(this.props.groupId).then(() => { + + this._groupStore.joinGroup().then(() => { // don't reset membershipBusy here: wait for the membership change to come down the sync }).catch((e) => { this.setState({membershipBusy: false}); @@ -715,7 +724,7 @@ export default React.createClass({ if (!confirmed) return; this.setState({membershipBusy: true}); - this._matrixClient.leaveGroup(this.props.groupId).then(() => { + this._groupStore.leaveGroup().then(() => { // don't reset membershipBusy here: wait for the membership change to come down the sync }).catch((e) => { this.setState({membershipBusy: false}); @@ -989,8 +998,8 @@ export default React.createClass({ return
- { /* Empty div for flex alignment */ } -
+ { /* The
is for flex alignment */ } + { this.state.membershipBusy ? :
}