From 3f0e596e97b7c3c36ec16ab3568791497ee67d7e Mon Sep 17 00:00:00 2001 From: Luke Barnard Date: Thu, 21 Sep 2017 12:44:17 +0100 Subject: [PATCH] Only show "Add" button when editing the group --- src/components/structures/GroupView.js | 44 ++++++++++++++++++++------ 1 file changed, 34 insertions(+), 10 deletions(-) diff --git a/src/components/structures/GroupView.js b/src/components/structures/GroupView.js index 7d64820c5e..1b4b5cb809 100644 --- a/src/components/structures/GroupView.js +++ b/src/components/structures/GroupView.js @@ -55,6 +55,9 @@ const CategoryRoomList = React.createClass({ name: PropTypes.string, }).isRequired, }), + + // Whether the list should be editable + editing: PropTypes.bool.isRequired, }, render: function() { @@ -136,6 +139,9 @@ const RoleUserList = React.createClass({ }).isRequired, }), groupId: PropTypes.string.isRequired, + + // Whether the list should be editable + editing: PropTypes.bool.isRequired, }, onAddUsersClicked: function(ev) { @@ -178,6 +184,13 @@ const RoleUserList = React.createClass({ render: function() { const TintableSvg = sdk.getComponent("elements.TintableSvg"); + const addButton = this.props.editing ? + ( + +
+ {_t('Add a User')} +
+
) : null; const userNodes = this.props.users.map((u) => { return ; }); @@ -188,12 +201,7 @@ const RoleUserList = React.createClass({ return
{roleHeader} {userNodes} - - -
- {_t('Add a User')} -
-
+ {addButton}
; }, }); @@ -446,10 +454,16 @@ export default React.createClass({ } }); - const defaultCategoryNode = ; + const defaultCategoryNode = ; const categoryRoomNodes = Object.keys(categoryRooms).map((catId) => { const cat = summary.rooms_section.categories[catId]; - return ; + return ; }); return
@@ -479,10 +493,18 @@ export default React.createClass({ } }); - const noRoleNode = ; + const noRoleNode = ; const roleUserNodes = Object.keys(roleUsers).map((roleId) => { const role = summary.users_section.roles[roleId]; - return ; + return ; }); return
@@ -613,6 +635,8 @@ export default React.createClass({ onChange={this._onLongDescChange} tabIndex="3" /> + {this._getFeaturedRoomsNode()} + {this._getFeaturedUsersNode()}
; } else { const groupAvatarUrl = summary.profile ? summary.profile.avatar_url : null;