mirror of
https://github.com/vector-im/element-web.git
synced 2024-11-16 13:14:58 +08:00
Merge pull request #1419 from matrix-org/dbkr/publicity_toggle
Add status & toggle for publicity
This commit is contained in:
commit
e42e7bd3ad
@ -379,6 +379,7 @@ export default React.createClass({
|
|||||||
saving: false,
|
saving: false,
|
||||||
uploadingAvatar: false,
|
uploadingAvatar: false,
|
||||||
membershipBusy: false,
|
membershipBusy: false,
|
||||||
|
publicityBusy: false,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -560,7 +561,28 @@ export default React.createClass({
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
_getFeaturedRoomsNode() {
|
_onPubliciseOffClick: function() {
|
||||||
|
this._setPublicity(false);
|
||||||
|
},
|
||||||
|
|
||||||
|
_onPubliciseOnClick: function() {
|
||||||
|
this._setPublicity(true);
|
||||||
|
},
|
||||||
|
|
||||||
|
_setPublicity: function(publicity) {
|
||||||
|
this.setState({
|
||||||
|
publicityBusy: true,
|
||||||
|
});
|
||||||
|
MatrixClientPeg.get().setGroupPublicity(this.props.groupId, publicity).then(() => {
|
||||||
|
this._loadGroupFromServer(this.props.groupId);
|
||||||
|
}).then(() => {
|
||||||
|
this.setState({
|
||||||
|
publicityBusy: false,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
_getFeaturedRoomsNode: function() {
|
||||||
const summary = this.state.summary;
|
const summary = this.state.summary;
|
||||||
|
|
||||||
const defaultCategoryRooms = [];
|
const defaultCategoryRooms = [];
|
||||||
@ -601,7 +623,7 @@ export default React.createClass({
|
|||||||
</div>;
|
</div>;
|
||||||
},
|
},
|
||||||
|
|
||||||
_getFeaturedUsersNode() {
|
_getFeaturedUsersNode: function() {
|
||||||
const summary = this.state.summary;
|
const summary = this.state.summary;
|
||||||
|
|
||||||
const noRoleUsers = [];
|
const noRoleUsers = [];
|
||||||
@ -643,12 +665,12 @@ export default React.createClass({
|
|||||||
},
|
},
|
||||||
|
|
||||||
_getMembershipSection: function() {
|
_getMembershipSection: function() {
|
||||||
|
const Spinner = sdk.getComponent("elements.Spinner");
|
||||||
|
|
||||||
const group = MatrixClientPeg.get().getGroup(this.props.groupId);
|
const group = MatrixClientPeg.get().getGroup(this.props.groupId);
|
||||||
if (!group) return null;
|
if (!group) return null;
|
||||||
|
|
||||||
if (group.myMembership === 'invite') {
|
if (group.myMembership === 'invite') {
|
||||||
const Spinner = sdk.getComponent("elements.Spinner");
|
|
||||||
|
|
||||||
if (this.state.membershipBusy) {
|
if (this.state.membershipBusy) {
|
||||||
return <div className="mx_GroupView_membershipSection">
|
return <div className="mx_GroupView_membershipSection">
|
||||||
<Spinner />
|
<Spinner />
|
||||||
@ -677,7 +699,45 @@ export default React.createClass({
|
|||||||
if (this.state.summary.user && this.state.summary.user.is_privileged) {
|
if (this.state.summary.user && this.state.summary.user.is_privileged) {
|
||||||
youAreAMemberText = _t("You are an administrator of this group");
|
youAreAMemberText = _t("You are an administrator of this group");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let publicisedButton;
|
||||||
|
if (this.state.publicityBusy) {
|
||||||
|
publicisedButton = <Spinner />;
|
||||||
|
}
|
||||||
|
|
||||||
|
let publicisedSection;
|
||||||
|
if (this.state.summary.user && this.state.summary.user.is_public) {
|
||||||
|
if (!this.state.publicityBusy) {
|
||||||
|
publicisedButton = <AccessibleButton className="mx_GroupView_textButton mx_RoomHeader_textButton"
|
||||||
|
onClick={this._onPubliciseOffClick}
|
||||||
|
>
|
||||||
|
{_t("Make private")}
|
||||||
|
</AccessibleButton>;
|
||||||
|
}
|
||||||
|
publicisedSection = <div className="mx_GroupView_membershipSubSection">
|
||||||
|
{_t("Your membership of this group is public")}
|
||||||
|
<div className="mx_GroupView_membership_buttonContainer">
|
||||||
|
{publicisedButton}
|
||||||
|
</div>
|
||||||
|
</div>;
|
||||||
|
} else {
|
||||||
|
if (!this.state.publicityBusy) {
|
||||||
|
publicisedButton = <AccessibleButton className="mx_GroupView_textButton mx_RoomHeader_textButton"
|
||||||
|
onClick={this._onPubliciseOnClick}
|
||||||
|
>
|
||||||
|
{_t("Make public")}
|
||||||
|
</AccessibleButton>;
|
||||||
|
}
|
||||||
|
publicisedSection = <div className="mx_GroupView_membershipSubSection">
|
||||||
|
{_t("Your membership of this group is private")}
|
||||||
|
<div className="mx_GroupView_membership_buttonContainer">
|
||||||
|
{publicisedButton}
|
||||||
|
</div>
|
||||||
|
</div>;
|
||||||
|
}
|
||||||
|
|
||||||
return <div className="mx_GroupView_membershipSection mx_GroupView_membershipSection_joined">
|
return <div className="mx_GroupView_membershipSection mx_GroupView_membershipSection_joined">
|
||||||
|
<div className="mx_GroupView_membershipSubSection">
|
||||||
<div className="mx_GroupView_membershipSection_description">
|
<div className="mx_GroupView_membershipSection_description">
|
||||||
{youAreAMemberText}
|
{youAreAMemberText}
|
||||||
</div>
|
</div>
|
||||||
@ -688,6 +748,8 @@ export default React.createClass({
|
|||||||
{_t("Leave")}
|
{_t("Leave")}
|
||||||
</AccessibleButton>
|
</AccessibleButton>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
{publicisedSection}
|
||||||
</div>;
|
</div>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -879,5 +879,11 @@
|
|||||||
"Failed to remove the room from the summary of %(groupId)s": "Failed to remove the room from the summary of %(groupId)s",
|
"Failed to remove the room from the summary of %(groupId)s": "Failed to remove the room from the summary of %(groupId)s",
|
||||||
"The room '%(roomName)s' could not be removed from the summary.": "The room '%(roomName)s' could not be removed from the summary.",
|
"The room '%(roomName)s' could not be removed from the summary.": "The room '%(roomName)s' could not be removed from the summary.",
|
||||||
"Failed to remove a user from the summary of %(groupId)s": "Failed to remove a user from the summary of %(groupId)s",
|
"Failed to remove a user from the summary of %(groupId)s": "Failed to remove a user from the summary of %(groupId)s",
|
||||||
"The user '%(displayName)s' could not be removed from the summary.": "The user '%(displayName)s' could not be removed from the summary."
|
"The user '%(displayName)s' could not be removed from the summary.": "The user '%(displayName)s' could not be removed from the summary.",
|
||||||
|
"Failed to add the following rooms to the summary of %(groupId)s:": "Failed to add the following rooms to the summary of %(groupId)s:",
|
||||||
|
"The room '%(roomName)s' could not be removed from the summary.": "The room '%(roomName)s' could not be removed from the summary.",
|
||||||
|
"Your membership of this group is public": "Your membership of this group is public",
|
||||||
|
"Your membership of this group is private": "Your membership of this group is private",
|
||||||
|
"Make private": "Make private",
|
||||||
|
"Make public": "Make public"
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user