From e2b3fc3519dec4ac58f80524fe132067668adec9 Mon Sep 17 00:00:00 2001 From: Matthew Hodgson Date: Sat, 17 Sep 2016 03:02:14 +0100 Subject: [PATCH] only show invite button for rooms you're in --- src/components/structures/RightPanel.js | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/src/components/structures/RightPanel.js b/src/components/structures/RightPanel.js index 8c6e9fa236..d1622e5f41 100644 --- a/src/components/structures/RightPanel.js +++ b/src/components/structures/RightPanel.js @@ -197,9 +197,24 @@ module.exports = React.createClass({ if ((this.state.phase == this.Phase.MemberList || this.state.phase === this.Phase.MemberInfo) && this.props.roomId) { var cli = MatrixClientPeg.get(); var room = cli.getRoom(this.props.roomId); + var user_is_in_room; if (room) { membersBadge = room.getJoinedMembers().length; + user_is_in_room = room.hasMembershipState( + MatrixClientPeg.get().credentials.userId, 'join' + ); } + + if (user_is_in_room) { + inviteGroup = +
+
+ +
+
Invite to this room
+
; + } + } if (this.props.roomId) { @@ -221,14 +236,6 @@ module.exports = React.createClass({ { notificationsHighlight } ; - - inviteGroup = -
-
- -
-
Invite to this room
-
; } if (!this.props.collapsed) {