diff --git a/src/components/structures/GroupView.js b/src/components/structures/GroupView.js
index b2e49fb67a..52680ea5fa 100644
--- a/src/components/structures/GroupView.js
+++ b/src/components/structures/GroupView.js
@@ -481,6 +481,10 @@ export default React.createClass({
editing: true,
profileForm: Object.assign({}, this.state.summary.profile),
});
+ dis.dispatch({
+ action: 'ui_opacity',
+ sideOpacity: 0.3,
+ });
},
_onCancelClick: function() {
@@ -488,6 +492,7 @@ export default React.createClass({
editing: false,
profileForm: null,
});
+ dis.dispatch({action: 'ui_opacity'});
},
_onNameChange: function(value) {
@@ -535,12 +540,16 @@ export default React.createClass({
_onSaveClick: function() {
this.setState({saving: true});
- MatrixClientPeg.get().setGroupProfile(this.props.groupId, this.state.profileForm).then((result) => {
+ const savePromise = this.state.isUserPrivileged ?
+ MatrixClientPeg.get().setGroupProfile(this.props.groupId, this.state.profileForm) :
+ Promise.resolve();
+ savePromise.then((result) => {
this.setState({
saving: false,
editing: false,
summary: null,
});
+ dis.dispatch({action: 'ui_opacity'});
this._initGroupStore(this.props.groupId);
}).catch((e) => {
this.setState({
@@ -624,23 +633,40 @@ export default React.createClass({
});
},
+ _getGroupSection: function() {
+ const groupSettingsSectionClasses = classnames({
+ "mx_GroupView_group": this.state.editing,
+ "mx_GroupView_group_disabled": this.state.editing && !this.state.isUserPrivileged,
+ });
+
+ const header = this.state.editing ?
{ _t('Community Settings') }
: ;
+ return
+ { header }
+ { this._getLongDescriptionNode() }
+ { this._getRoomsNode() }
+
;
+ },
+
_getRoomsNode: function() {
const RoomDetailList = sdk.getComponent('rooms.RoomDetailList');
const AccessibleButton = sdk.getComponent('elements.AccessibleButton');
const TintableSvg = sdk.getComponent('elements.TintableSvg');
- const addButton = this.state.editing ?
- (
-
+
+ const addRoomRow = this.state.editing ?
+ (
+
-
+
{ _t('Add rooms to this community') }
) :
;
return
{ _t('Rooms') }
- { addButton }
+ { addRoomRow }
;
@@ -790,7 +816,7 @@ export default React.createClass({
_getMemberSettingsSection: function() {
return
-
{ _t("Community Member Settings") }
+
{ _t("Community Member Settings") }
+ const groupDescEditingClasses = classnames({
+ "mx_GroupView_groupDesc": true,
+ "mx_GroupView_groupDesc_disabled": !this.state.isUserPrivileged,
+ });
+
+ return this.state.editing ?
+
{ _t("Long Description (HTML)") }
;
@@ -900,19 +927,6 @@ export default React.createClass({
onValueChanged={this._onShortDescChange}
tabIndex="2"
dir="auto" />;
- rightButtons.push(
-
- { _t('Save') }
- ,
- );
- rightButtons.push(
-
-
- ,
- );
} else {
const groupAvatarUrl = summary.profile ? summary.profile.avatar_url : null;
avatarNode =
{ summary.profile.short_description };
}
+ }
+ if (this.state.editing) {
+ rightButtons.push(
+
+ { _t('Save') }
+ ,
+ );
+ rightButtons.push(
+
+
+ ,
+ );
+ } else {
rightButtons.push(
,
);
}
-
- headerClasses.mx_GroupView_header_view = true;
}
+ const headerClasses = {
+ mx_GroupView_header: true,
+ mx_GroupView_header_view: !this.state.editing,
+ };
+
return (