diff --git a/src/components/structures/GroupView.js b/src/components/structures/GroupView.js index 7c8ef80b80..26f8c4a413 100644 --- a/src/components/structures/GroupView.js +++ b/src/components/structures/GroupView.js @@ -458,6 +458,8 @@ export default React.createClass({ } this.setState({ summary, + isGroupPublicised: this._groupStore.getGroupPublicity(), + isUserPrivileged: this._groupStore.isUserPrivileged(), error: null, }); }); @@ -606,22 +608,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, @@ -745,100 +740,113 @@ export default React.createClass({ ; } - return
-
- { _t("%(inviter)s has invited you to join this group", {inviter: group.inviter.userId}) } -
-
- - { _t("Accept") } - - - { _t("Decline") } - -
-
; - } else if (group.myMembership === 'join') { - 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 } -
-
; - } - - return
- { youAreAMemberText } + { _t("%(inviter)s has invited you to join this group", {inviter: group.inviter.userId}) }
+ { _t("Accept") } + + + { _t("Decline") } + +
+
+
; + } else if (group.myMembership === 'join' && this.state.editing) { + 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
+
+ { /* Empty div for flex alignment */ } +
+
+ { _t("Leave") }
- { publicisedSection }
; } - return null; }, + _getMemberSettingsSection: function() { + return
+

{ _t("Community Member Settings") }

+
+ + +
+
; + }, + + _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)") }

+