Merge pull request #5009 from matrix-org/t3chguy/fix/14573

Null guard no e2ee for UserInfo
This commit is contained in:
Michael Telatynski 2020-07-17 13:44:51 +01:00 committed by GitHub
commit 549bacabc3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1287,11 +1287,11 @@ const BasicUserInfo = ({room, member, groupId, devices, isRoomEncrypted}) => {
); );
// only display the devices list if our client supports E2E // only display the devices list if our client supports E2E
const _enableDevices = cli.isCryptoEnabled(); const cryptoEnabled = cli.isCryptoEnabled();
let text; let text;
if (!isRoomEncrypted) { if (!isRoomEncrypted) {
if (!_enableDevices) { if (!cryptoEnabled) {
text = _t("This client does not support end-to-end encryption."); text = _t("This client does not support end-to-end encryption.");
} else if (room) { } else if (room) {
text = _t("Messages in this room are not end-to-end encrypted."); text = _t("Messages in this room are not end-to-end encrypted.");
@ -1305,10 +1305,10 @@ const BasicUserInfo = ({room, member, groupId, devices, isRoomEncrypted}) => {
let verifyButton; let verifyButton;
const homeserverSupportsCrossSigning = useHomeserverSupportsCrossSigning(cli); const homeserverSupportsCrossSigning = useHomeserverSupportsCrossSigning(cli);
const userTrust = cli.checkUserTrust(member.userId); const userTrust = cryptoEnabled && cli.checkUserTrust(member.userId);
const userVerified = userTrust.isCrossSigningVerified(); const userVerified = cryptoEnabled && userTrust.isCrossSigningVerified();
const isMe = member.userId === cli.getUserId(); const isMe = member.userId === cli.getUserId();
const canVerify = homeserverSupportsCrossSigning && !userVerified && !isMe; const canVerify = cryptoEnabled && homeserverSupportsCrossSigning && !userVerified && !isMe;
const setUpdating = (updating) => { const setUpdating = (updating) => {
setPendingUpdateCount(count => count + (updating ? 1 : -1)); setPendingUpdateCount(count => count + (updating ? 1 : -1));
@ -1345,10 +1345,10 @@ const BasicUserInfo = ({room, member, groupId, devices, isRoomEncrypted}) => {
<h3>{ _t("Security") }</h3> <h3>{ _t("Security") }</h3>
<p>{ text }</p> <p>{ text }</p>
{ verifyButton } { verifyButton }
<DevicesSection { cryptoEnabled && <DevicesSection
loading={showDeviceListSpinner} loading={showDeviceListSpinner}
devices={devices} devices={devices}
userId={member.userId} /> userId={member.userId} /> }
</div> </div>
); );