Add radio button for setting group is_joinable
which dictates whether the group can be joined without invitation.
This commit is contained in:
parent
b40b417153
commit
f42cdf6a4c
2 changed files with 53 additions and 3 deletions
|
@ -545,6 +545,9 @@ export default React.createClass({
|
||||||
this.setState({
|
this.setState({
|
||||||
editing: true,
|
editing: true,
|
||||||
profileForm: Object.assign({}, this.state.summary.profile),
|
profileForm: Object.assign({}, this.state.summary.profile),
|
||||||
|
joinableForm: {
|
||||||
|
isJoinable: this.state.summary.profile.is_joinable,
|
||||||
|
},
|
||||||
});
|
});
|
||||||
dis.dispatch({
|
dis.dispatch({
|
||||||
action: 'panel_disable',
|
action: 'panel_disable',
|
||||||
|
@ -607,11 +610,15 @@ export default React.createClass({
|
||||||
}).done();
|
}).done();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
_onJoinableChange: function(ev) {
|
||||||
|
this.setState({
|
||||||
|
joinableForm: { isJoinable: ev.target.value === "true" },
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
_onSaveClick: function() {
|
_onSaveClick: function() {
|
||||||
this.setState({saving: true});
|
this.setState({saving: true});
|
||||||
const savePromise = this.state.isUserPrivileged ?
|
const savePromise = this.state.isUserPrivileged ? this._saveGroup() : Promise.resolve();
|
||||||
this._matrixClient.setGroupProfile(this.props.groupId, this.state.profileForm) :
|
|
||||||
Promise.resolve();
|
|
||||||
savePromise.then((result) => {
|
savePromise.then((result) => {
|
||||||
this.setState({
|
this.setState({
|
||||||
saving: false,
|
saving: false,
|
||||||
|
@ -642,6 +649,11 @@ export default React.createClass({
|
||||||
}).done();
|
}).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() {
|
_onAcceptInviteClick: function() {
|
||||||
this.setState({membershipBusy: true});
|
this.setState({membershipBusy: true});
|
||||||
this._groupStore.acceptGroupInvite().then(() => {
|
this._groupStore.acceptGroupInvite().then(() => {
|
||||||
|
@ -715,6 +727,7 @@ export default React.createClass({
|
||||||
return <div className={groupSettingsSectionClasses}>
|
return <div className={groupSettingsSectionClasses}>
|
||||||
{ header }
|
{ header }
|
||||||
{ changeDelayWarning }
|
{ changeDelayWarning }
|
||||||
|
{ this._getJoinableNode() }
|
||||||
{ this._getLongDescriptionNode() }
|
{ this._getLongDescriptionNode() }
|
||||||
{ this._getRoomsNode() }
|
{ this._getRoomsNode() }
|
||||||
</div>;
|
</div>;
|
||||||
|
@ -925,6 +938,41 @@ export default React.createClass({
|
||||||
return null;
|
return null;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
_getJoinableNode: function() {
|
||||||
|
return this.state.editing ? <div>
|
||||||
|
<h3>
|
||||||
|
{ _t('Who can join this community?') }
|
||||||
|
{ this.state.groupJoinableLoading ?
|
||||||
|
<InlineSpinner /> : <div />
|
||||||
|
}
|
||||||
|
</h3>
|
||||||
|
<div>
|
||||||
|
<label>
|
||||||
|
<input type="radio"
|
||||||
|
value="false"
|
||||||
|
checked={!this.state.joinableForm.isJoinable}
|
||||||
|
onClick={this._onJoinableChange}
|
||||||
|
/>
|
||||||
|
<div className="mx_GroupView_label_text">
|
||||||
|
{ _t('Only people who have been invited') }
|
||||||
|
</div>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<label>
|
||||||
|
<input type="radio"
|
||||||
|
value="true"
|
||||||
|
checked={this.state.joinableForm.isJoinable}
|
||||||
|
onClick={this._onJoinableChange}
|
||||||
|
/>
|
||||||
|
<div className="mx_GroupView_label_text">
|
||||||
|
{ _t('Everyone') }
|
||||||
|
</div>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
</div> : null;
|
||||||
|
},
|
||||||
|
|
||||||
_getLongDescriptionNode: function() {
|
_getLongDescriptionNode: function() {
|
||||||
const summary = this.state.summary;
|
const summary = this.state.summary;
|
||||||
let description = null;
|
let description = null;
|
||||||
|
|
|
@ -776,6 +776,8 @@
|
||||||
"%(inviter)s has invited you to join this community": "%(inviter)s has invited you to join this community",
|
"%(inviter)s has invited you to join this community": "%(inviter)s has invited you to join this community",
|
||||||
"You are an administrator of this community": "You are an administrator of this community",
|
"You are an administrator of this community": "You are an administrator of this community",
|
||||||
"You are a member of this community": "You are a member of this community",
|
"You are a member of this community": "You are a member of this community",
|
||||||
|
"Who can join this community?": "Who can join this community?",
|
||||||
|
"Everyone": "Everyone",
|
||||||
"Your community hasn't got a Long Description, a HTML page to show to community members.<br />Click here to open settings and give it one!": "Your community hasn't got a Long Description, a HTML page to show to community members.<br />Click here to open settings and give it one!",
|
"Your community hasn't got a Long Description, a HTML page to show to community members.<br />Click here to open settings and give it one!": "Your community hasn't got a Long Description, a HTML page to show to community members.<br />Click here to open settings and give it one!",
|
||||||
"Long Description (HTML)": "Long Description (HTML)",
|
"Long Description (HTML)": "Long Description (HTML)",
|
||||||
"Description": "Description",
|
"Description": "Description",
|
||||||
|
|
Loading…
Reference in a new issue