diff --git a/src/components/structures/GroupView.js b/src/components/structures/GroupView.js
index e12dc22491..21c503fbf1 100644
--- a/src/components/structures/GroupView.js
+++ b/src/components/structures/GroupView.js
@@ -600,22 +600,15 @@ export default React.createClass({
});
},
- _onPubliciseOffClick: function() {
- this._setPublicity(false);
- },
-
- _onPubliciseOnClick: function() {
- this._setPublicity(true);
- },
-
_onAddRoomsClick: function() {
showGroupAddRoomDialog(this.props.groupId);
},
- _setPublicity: function(publicity) {
+ _onPublicityToggle: function() {
this.setState({
publicityBusy: true,
});
+ const publicity = !this.state.isGroupPublicised;
this._groupStore.setGroupPublicity(publicity).then(() => {
this.setState({
publicityBusy: false,
@@ -739,7 +732,6 @@ export default React.createClass({
;
}
-
return
@@ -760,81 +752,93 @@ export default React.createClass({
;
} else if (group.myMembership === 'join' && this.state.editing) {
- let youAreAMemberText = _t("You are a member of this group");
- if (this.state.summary.user && this.state.summary.user.is_privileged) {
- youAreAMemberText = _t("You are an administrator of this group");
- }
-
- let publicisedButton;
- if (this.state.publicityBusy) {
- publicisedButton =
;
- }
-
- let publicisedSection;
- if (this.state.summary.user && this.state.summary.user.is_publicised) {
- if (!this.state.publicityBusy) {
- publicisedButton =
- { _t("Unpublish") }
- ;
- }
- publicisedSection =
- { _t("This group is published on your profile") }
-
- { publicisedButton }
-
-
;
- } else {
- if (!this.state.publicityBusy) {
- publicisedButton =
- { _t("Publish") }
- ;
- }
- publicisedSection =
- { _t("This group is not published on your profile") }
-
- { publicisedButton }
-
-
;
- }
-
+ const leaveButtonTooltip = this.state.isUserPrivileged ?
+ _t("You are a member of this group") :
+ _t("You are an administrator of this group");
+ const leaveButtonClasses = classnames({
+ "mx_RoomHeader_textButton": true,
+ "mx_GroupView_textButton": true,
+ "mx_GroupView_leaveButton": true,
+ "mx_RoomHeader_textButton_danger": this.state.isUserPrivileged,
+ });
return
-
- { youAreAMemberText }
-
+ { /* Empty div for flex alignment */ }
+
- { publicisedSection }
;
}
-
return null;
},
+ _getMemberSettingsSection: function() {
+ return
+
{ _t("Community Member Settings") }
+
+
+
+ { _t("Publish this community on your profile") }
+
+
+
;
+ },
+
+ _getLongDescriptionNode: function() {
+ const summary = this.state.summary;
+ let description = null;
+ if (summary.profile && summary.profile.long_description) {
+ description = sanitizedHtmlNode(summary.profile.long_description);
+ }
+ return this.state.editing && this.state.isUserPrivileged ?
+
+
{ _t("Long Description (HTML)") }
+
+ :
+
+ { description }
+
;
+ },
+
render: function() {
const GroupAvatar = sdk.getComponent("avatars.GroupAvatar");
- const Loader = sdk.getComponent("elements.Spinner");
+ const Spinner = sdk.getComponent("elements.Spinner");
const TintableSvg = sdk.getComponent("elements.TintableSvg");
if (this.state.summary === null && this.state.error === null || this.state.saving) {
- return
;
+ return
;
} else if (this.state.summary) {
const summary = this.state.summary;
let avatarNode;
let nameNode;
let shortDescNode;
- let bodyNodes = [];
+ const bodyNodes = [
+ this._getMembershipSection(),
+ this.state.editing ? this._getMemberSettingsSection() : null,
+ this._getLongDescriptionNode(),
+ this._getRoomsNode(),
+ ];
const rightButtons = [];
const headerClasses = {
mx_GroupView_header: true,
@@ -842,7 +846,7 @@ export default React.createClass({
if (this.state.editing) {
let avatarImage;
if (this.state.uploadingAvatar) {
- avatarImage =
;
+ avatarImage =
;
} else {
const GroupAvatar = sdk.getComponent('avatars.GroupAvatar');
avatarImage =
,
);
- bodyNodes = [
- this._getMembershipSection(),
-
,
- this._getRoomsNode(),
- ];
} else {
const groupAvatarUrl = summary.profile ? summary.profile.avatar_url : null;
avatarNode =
{ summary.profile.short_description };
}
-
- let description = null;
- if (summary.profile && summary.profile.long_description) {
- description = sanitizedHtmlNode(summary.profile.long_description);
- }
- bodyNodes = [
- this._getMembershipSection(),
- { description }
,
- this._getRoomsNode(),
- ];
- if (summary.user && summary.user.is_privileged) {
- rightButtons.push(
-
-
- ,
- );
- }
+ rightButtons.push(
+
+
+ ,
+ );
if (this.props.collapsedRhs) {
rightButtons.push(