Merge pull request #5220 from matrix-org/t3chguy/fix/15202

Clean up UserInfo to not show a blank Power Selector for users not in room
pull/21833/head
Michael Telatynski 2020-09-16 16:04:15 +01:00 committed by GitHub
commit 4d15a44d61
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 24 additions and 27 deletions

View File

@ -952,7 +952,6 @@ function useRoomPermissions(cli, room, user) {
const PowerLevelSection = ({user, room, roomPermissions, powerLevels}) => { const PowerLevelSection = ({user, room, roomPermissions, powerLevels}) => {
const [isEditing, setEditing] = useState(false); const [isEditing, setEditing] = useState(false);
if (room && user.roomId) { // is in room
if (isEditing) { if (isEditing) {
return (<PowerLevelEditor return (<PowerLevelEditor
user={user} room={room} roomPermissions={roomPermissions} user={user} room={room} roomPermissions={roomPermissions}
@ -974,9 +973,6 @@ const PowerLevelSection = ({user, room, roomPermissions, powerLevels}) => {
</div> </div>
); );
} }
} else {
return null;
}
}; };
const PowerLevelEditor = ({user, room, roomPermissions, onFinished}) => { const PowerLevelEditor = ({user, room, roomPermissions, onFinished}) => {
@ -1268,14 +1264,15 @@ const BasicUserInfo = ({room, member, groupId, devices, isRoomEncrypted}) => {
spinner = <Loader imgClassName="mx_ContextualMenu_spinner" />; spinner = <Loader imgClassName="mx_ContextualMenu_spinner" />;
} }
const memberDetails = ( let memberDetails;
<PowerLevelSection if (room && member.roomId) {
memberDetails = <PowerLevelSection
powerLevels={powerLevels} powerLevels={powerLevels}
user={member} user={member}
room={room} room={room}
roomPermissions={roomPermissions} roomPermissions={roomPermissions}
/> />;
); }
// only display the devices list if our client supports E2E // only display the devices list if our client supports E2E
const cryptoEnabled = cli.isCryptoEnabled(); const cryptoEnabled = cli.isCryptoEnabled();