Null guard no e2ee for UserInfo

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
pull/21833/head
Michael Telatynski 2020-07-17 10:49:57 +01:00
parent ddb5c7fb24
commit 5c8d12ab25
1 changed files with 6 additions and 6 deletions

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,8 +1305,8 @@ 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 = homeserverSupportsCrossSigning && !userVerified && !isMe;
@ -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>
); );