From 20bf69c3c24a9785badecaeb8339e7e6d09973c0 Mon Sep 17 00:00:00 2001 From: Luke Barnard Date: Tue, 31 Oct 2017 10:54:44 +0000 Subject: [PATCH] Prevent non-members from opening group settings --- src/components/structures/GroupView.js | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/components/structures/GroupView.js b/src/components/structures/GroupView.js index fa75df53f0..e643e63df2 100644 --- a/src/components/structures/GroupView.js +++ b/src/components/structures/GroupView.js @@ -460,6 +460,9 @@ export default React.createClass({ summary, isGroupPublicised: this._groupStore.getGroupPublicity(), isUserPrivileged: this._groupStore.isUserPrivileged(), + isUserMember: this._groupStore.getGroupMembers().some( + (m) => m.userId === MatrixClientPeg.get().credentials.userId, + ), error: null, }); }); @@ -928,27 +931,28 @@ export default React.createClass({ tabIndex="2" dir="auto" />; } else { + const onGroupHeaderItemClick = this.state.isUserMember ? this._onEditClick : null; const groupAvatarUrl = summary.profile ? summary.profile.avatar_url : null; const groupName = summary.profile ? summary.profile.name : null; avatarNode = ; if (summary.profile && summary.profile.name) { - nameNode =
+ nameNode =
{ summary.profile.name } ({ this.props.groupId })
; } else { - nameNode = { this.props.groupId }; + nameNode = { this.props.groupId }; } if (summary.profile && summary.profile.short_description) { - shortDescNode = { summary.profile.short_description }; + shortDescNode = { summary.profile.short_description }; } } if (this.state.editing) { @@ -989,6 +993,7 @@ export default React.createClass({ const headerClasses = { mx_GroupView_header: true, mx_GroupView_header_view: !this.state.editing, + mx_GroupView_header_isUserMember: this.state.isUserMember, }; return (