only show invite button for rooms you're in

This commit is contained in:
Matthew Hodgson 2016-09-17 03:02:14 +01:00
parent ab3c1509c5
commit e2b3fc3519
1 changed files with 15 additions and 8 deletions

View File

@ -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 =
<div className="mx_RightPanel_invite" onClick={ this.onInviteButtonClick } >
<div className="mx_RightPanel_icon" >
<TintableSvg src="img/icon-invite-people.svg" width="35" height="35" />
</div>
<div className="mx_RightPanel_message">Invite to this room</div>
</div>;
}
}
if (this.props.roomId) {
@ -221,14 +236,6 @@ module.exports = React.createClass({
{ notificationsHighlight }
</div>
</div>;
inviteGroup =
<div className="mx_RightPanel_invite" onClick={ this.onInviteButtonClick } >
<div className="mx_RightPanel_icon" >
<TintableSvg src="img/icon-invite-people.svg" width="35" height="35" />
</div>
<div className="mx_RightPanel_message">Invite to this room</div>
</div>;
}
if (!this.props.collapsed) {