Update to use new join_policy API

pull/21833/head
David Baker 2018-04-05 16:56:35 +01:00
parent c9283ad988
commit 03747b8287
1 changed files with 12 additions and 10 deletions

View File

@ -1,6 +1,6 @@
/*
Copyright 2017 Vector Creations Ltd.
Copyright 2017 New Vector Ltd.
Copyright 2017, 2018 New Vector Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@ -399,8 +399,8 @@ FeaturedRoom.contextTypes = GroupContext;
RoleUserList.contextTypes = GroupContext;
FeaturedUser.contextTypes = GroupContext;
const GROUP_JOINABLE = "GROUP_JOINABLE";
const GROUP_NOT_JOINABLE = "GROUP_NOT_JOINABLE";
const GROUP_JOINPOLICY_OPEN = "open";
const GROUP_JOINPOLICY_INVITE = "invite";
export default React.createClass({
displayName: 'GroupView',
@ -549,7 +549,7 @@ export default React.createClass({
editing: true,
profileForm: Object.assign({}, this.state.summary.profile),
joinableForm: {
isJoinable: this.state.summary.profile.is_joinable,
policyType: this.state.summary.profile.join_policy,
},
});
dis.dispatch({
@ -615,7 +615,7 @@ export default React.createClass({
_onJoinableChange: function(ev) {
this.setState({
joinableForm: { isJoinable: ev.target.value === GROUP_JOINABLE },
joinableForm: { policyType: ev.target.value },
});
},
@ -654,7 +654,9 @@ export default React.createClass({
_saveGroup: async function() {
await this._matrixClient.setGroupProfile(this.props.groupId, this.state.profileForm);
await this._matrixClient.setGroupJoinable(this.props.groupId, this.state.joinableForm.isJoinable);
await this._matrixClient.setGroupJoinPolicy(this.props.groupId, {
type: this.state.joinableForm.policyType,
});
},
_onAcceptInviteClick: function() {
@ -1010,8 +1012,8 @@ export default React.createClass({
<div>
<label>
<input type="radio"
value={GROUP_NOT_JOINABLE}
checked={!this.state.joinableForm.isJoinable}
value={GROUP_JOINPOLICY_INVITE}
checked={this.state.joinableForm.policyType === GROUP_JOINPOLICY_INVITE}
onClick={this._onJoinableChange}
/>
<div className="mx_GroupView_label_text">
@ -1022,8 +1024,8 @@ export default React.createClass({
<div>
<label>
<input type="radio"
value={GROUP_JOINABLE}
checked={this.state.joinableForm.isJoinable}
value={GROUP_JOINPOLICY_OPEN}
checked={this.state.joinableForm.policyType === GROUP_JOINPOLICY_OPEN}
onClick={this._onJoinableChange}
/>
<div className="mx_GroupView_label_text">