From ee7ebc425ccef49512d3efdd770defed20870f76 Mon Sep 17 00:00:00 2001 From: Luke Barnard Date: Tue, 24 Oct 2017 16:19:09 +0100 Subject: [PATCH 1/3] Only show editing UI for aliases/related_groups for users /w power --- .../views/elements/EditableItemList.js | 24 +++++++++++-------- .../views/room_settings/AliasSettings.js | 1 + .../room_settings/RelatedGroupSettings.js | 1 + src/components/views/rooms/RoomSettings.js | 1 - 4 files changed, 16 insertions(+), 11 deletions(-) diff --git a/src/components/views/elements/EditableItemList.js b/src/components/views/elements/EditableItemList.js index 35e207daef..2352b80e9e 100644 --- a/src/components/views/elements/EditableItemList.js +++ b/src/components/views/elements/EditableItemList.js @@ -80,11 +80,13 @@ module.exports = React.createClass({ displayName: 'EditableItemList', propTypes: { - items: PropTypes.arrayOf(PropTypes.string).isRequired, + items: PropTypes.arrayOf(PropTypes. string).isRequired, onNewItemChanged: PropTypes.func, onItemAdded: PropTypes.func, onItemEdited: PropTypes.func, - onItemRemoved: PropTypes. func, + onItemRemoved: PropTypes.func, + + canEdit: PropTypes.bool, }, getDefaultProps: function() { @@ -136,14 +138,16 @@ module.exports = React.createClass({ { label } { editableItems } - + { this.props.canEdit ? + :
+ }
); }, }); diff --git a/src/components/views/room_settings/AliasSettings.js b/src/components/views/room_settings/AliasSettings.js index c64e876dbe..cb897c9daf 100644 --- a/src/components/views/room_settings/AliasSettings.js +++ b/src/components/views/room_settings/AliasSettings.js @@ -262,6 +262,7 @@ module.exports = React.createClass({ items={this.state.domainToAliases[localDomain] || []} newItem={this.state.newAlias} onNewItemChanged={this.onNewAliasChanged} + canEdit={this.props.canSetAliases} onItemAdded={this.onLocalAliasAdded} onItemEdited={this.onLocalAliasChanged} onItemRemoved={this.onLocalAliasDeleted} diff --git a/src/components/views/room_settings/RelatedGroupSettings.js b/src/components/views/room_settings/RelatedGroupSettings.js index 7227a951d7..ed2dd99db7 100644 --- a/src/components/views/room_settings/RelatedGroupSettings.js +++ b/src/components/views/room_settings/RelatedGroupSettings.js @@ -110,6 +110,7 @@ module.exports = React.createClass({ items={this.state.newGroupsList} className={"mx_RelatedGroupSettings"} newItem={this.state.newGroupId} + canEdit={this.props.canSetRelatedRooms} onNewItemChanged={this.onNewGroupChanged} onItemAdded={this.onGroupAdded} onItemEdited={this.onGroupEdited} diff --git a/src/components/views/rooms/RoomSettings.js b/src/components/views/rooms/RoomSettings.js index 9934456597..e3f667ab60 100644 --- a/src/components/views/rooms/RoomSettings.js +++ b/src/components/views/rooms/RoomSettings.js @@ -19,7 +19,6 @@ import Promise from 'bluebird'; import React from 'react'; import { _t, _tJsx, _td } from '../../../languageHandler'; import MatrixClientPeg from '../../../MatrixClientPeg'; -import SdkConfig from '../../../SdkConfig'; import sdk from '../../../index'; import Modal from '../../../Modal'; import ObjectUtils from '../../../ObjectUtils'; From 640d88f25d2888b126e0b94247ac76034dbbb73c Mon Sep 17 00:00:00 2001 From: Luke Barnard Date: Tue, 24 Oct 2017 16:21:18 +0100 Subject: [PATCH 2/3] Typo --- src/components/views/elements/EditableItemList.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/views/elements/EditableItemList.js b/src/components/views/elements/EditableItemList.js index 2352b80e9e..05ae625515 100644 --- a/src/components/views/elements/EditableItemList.js +++ b/src/components/views/elements/EditableItemList.js @@ -80,7 +80,7 @@ module.exports = React.createClass({ displayName: 'EditableItemList', propTypes: { - items: PropTypes.arrayOf(PropTypes. string).isRequired, + items: PropTypes.arrayOf(PropTypes.string).isRequired, onNewItemChanged: PropTypes.func, onItemAdded: PropTypes.func, onItemEdited: PropTypes.func, From e9ce7f97f556021b44becf7a700a37d43072d833 Mon Sep 17 00:00:00 2001 From: Luke Barnard Date: Tue, 24 Oct 2017 17:57:26 +0100 Subject: [PATCH 3/3] canSetRelatedRooms -> canSetRelatedGroups --- src/components/views/room_settings/RelatedGroupSettings.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/components/views/room_settings/RelatedGroupSettings.js b/src/components/views/room_settings/RelatedGroupSettings.js index ed2dd99db7..0a2dc3341c 100644 --- a/src/components/views/room_settings/RelatedGroupSettings.js +++ b/src/components/views/room_settings/RelatedGroupSettings.js @@ -27,7 +27,7 @@ module.exports = React.createClass({ propTypes: { roomId: React.PropTypes.string.isRequired, - canSetRelatedRooms: React.PropTypes.bool.isRequired, + canSetRelatedGroups: React.PropTypes.bool.isRequired, relatedGroupsEvent: React.PropTypes.instanceOf(MatrixEvent), }, @@ -37,7 +37,7 @@ module.exports = React.createClass({ getDefaultProps: function() { return { - canSetRelatedRooms: false, + canSetRelatedGroups: false, }; }, @@ -110,7 +110,7 @@ module.exports = React.createClass({ items={this.state.newGroupsList} className={"mx_RelatedGroupSettings"} newItem={this.state.newGroupId} - canEdit={this.props.canSetRelatedRooms} + canEdit={this.props.canSetRelatedGroups} onNewItemChanged={this.onNewGroupChanged} onItemAdded={this.onGroupAdded} onItemEdited={this.onGroupEdited}