Don't show admin tooling if we're not in the room

Fixes https://github.com/vector-im/element-web/issues/15480
This commit is contained in:
Travis Ralston 2020-10-16 13:43:08 -06:00
parent 3a0833e8a4
commit 5f3f7b5263

View file

@ -801,6 +801,11 @@ const RoomAdminToolsContainer: React.FC<IBaseRoomProps> = ({
} = powerLevels; } = powerLevels;
const me = room.getMember(cli.getUserId()); const me = room.getMember(cli.getUserId());
if (!me) {
// we aren't in the room, so return no admin tooling
return <div />;
}
const isMe = me.userId === member.userId; const isMe = me.userId === member.userId;
const canAffectUser = member.powerLevel < me.powerLevel || isMe; const canAffectUser = member.powerLevel < me.powerLevel || isMe;