diff --git a/src/components/structures/GroupView.js b/src/components/structures/GroupView.js index 30e897e5dc..a491bc65e0 100644 --- a/src/components/structures/GroupView.js +++ b/src/components/structures/GroupView.js @@ -546,6 +546,9 @@ export default React.createClass({ this.setState({ editing: true, profileForm: Object.assign({}, this.state.summary.profile), + joinableForm: { + isJoinable: this.state.summary.profile.is_joinable, + }, }); dis.dispatch({ action: 'panel_disable', @@ -608,11 +611,15 @@ export default React.createClass({ }).done(); }, + _onJoinableChange: function(ev) { + this.setState({ + joinableForm: { isJoinable: ev.target.value === "true" }, + }); + }, + _onSaveClick: function() { this.setState({saving: true}); - const savePromise = this.state.isUserPrivileged ? - this._matrixClient.setGroupProfile(this.props.groupId, this.state.profileForm) : - Promise.resolve(); + const savePromise = this.state.isUserPrivileged ? this._saveGroup() : Promise.resolve(); savePromise.then((result) => { this.setState({ saving: false, @@ -643,6 +650,11 @@ export default React.createClass({ }).done(); }, + _saveGroup: async function() { + await this._matrixClient.setGroupProfile(this.props.groupId, this.state.profileForm); + await this._matrixClient.setGroupJoinable(this.props.groupId, this.state.joinableForm.isJoinable); + }, + _onAcceptInviteClick: function() { this.setState({membershipBusy: true}); this._groupStore.acceptGroupInvite().then(() => { @@ -716,6 +728,7 @@ export default React.createClass({ return