Skip to content

Commit e2b3fc3

Browse files
committed
only show invite button for rooms you're in
1 parent ab3c150 commit e2b3fc3

1 file changed

Lines changed: 15 additions & 8 deletions

File tree

‎src/components/structures/RightPanel.js‎

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -197,9 +197,24 @@ module.exports = React.createClass({
197197
if ((this.state.phase == this.Phase.MemberList || this.state.phase === this.Phase.MemberInfo) && this.props.roomId) {
198198
var cli = MatrixClientPeg.get();
199199
var room = cli.getRoom(this.props.roomId);
200+
var user_is_in_room;
200201
if (room) {
201202
membersBadge = room.getJoinedMembers().length;
203+
user_is_in_room = room.hasMembershipState(
204+
MatrixClientPeg.get().credentials.userId, 'join'
205+
);
202206
}
207+
208+
if (user_is_in_room) {
209+
inviteGroup =
210+
<div className="mx_RightPanel_invite" onClick={ this.onInviteButtonClick } >
211+
<div className="mx_RightPanel_icon" >
212+
<TintableSvg src="img/icon-invite-people.svg" width="35" height="35" />
213+
</div>
214+
<div className="mx_RightPanel_message">Invite to this room</div>
215+
</div>;
216+
}
217+
203218
}
204219

205220
if (this.props.roomId) {
@@ -221,14 +236,6 @@ module.exports = React.createClass({
221236
{ notificationsHighlight }
222237
</div>
223238
</div>;
224-
225-
inviteGroup =
226-
<div className="mx_RightPanel_invite" onClick={ this.onInviteButtonClick } >
227-
<div className="mx_RightPanel_icon" >
228-
<TintableSvg src="img/icon-invite-people.svg" width="35" height="35" />
229-
</div>
230-
<div className="mx_RightPanel_message">Invite to this room</div>
231-
</div>;
232239
}
233240

234241
if (!this.props.collapsed) {

0 commit comments

Comments
 (0)