mirror of
https://github.com/vector-im/element-web.git
synced 2026-05-05 20:26:19 +02:00
Simplify DeviceListener logic: consider recovery disabled if backup is disabled
If backup is disabled, recovery is implicitly disabled too, so there is no need to warn about recovery being broken.
This commit is contained in:
parent
1e974d0d8b
commit
270a8d787d
@ -162,8 +162,6 @@ export class DeviceListenerCurrentDevice {
|
||||
|
||||
const recoveryDisabled = await this.recheckRecoveryDisabled(this.client);
|
||||
|
||||
const recoveryIsOk = secretStorageStatus.ready || recoveryDisabled;
|
||||
|
||||
const isCurrentDeviceTrusted = Boolean(
|
||||
(await crypto.getDeviceVerificationStatus(this.client.getSafeUserId(), this.client.deviceId!))
|
||||
?.crossSigningVerified,
|
||||
@ -172,6 +170,8 @@ export class DeviceListenerCurrentDevice {
|
||||
const keyBackupUploadActive = await this.isKeyBackupUploadActive(logSpan);
|
||||
const backupDisabled = await this.recheckBackupDisabled();
|
||||
|
||||
const recoveryIsOk = secretStorageStatus.ready || recoveryDisabled || backupDisabled;
|
||||
|
||||
// We warn if key backup upload is turned off and we have not explicitly
|
||||
// said we are OK with that.
|
||||
const keyBackupUploadIsOk = keyBackupUploadActive || backupDisabled;
|
||||
@ -216,16 +216,8 @@ export class DeviceListenerCurrentDevice {
|
||||
await this.setDeviceState("turn_on_key_storage", logSpan);
|
||||
} else if (!recoveryIsOk) {
|
||||
if (secretStorageStatus.defaultKeyId === null) {
|
||||
// The user just hasn't set up 4S yet: if they have key
|
||||
// backup, prompt them to turn on recovery too. (If not, they
|
||||
// have explicitly opted out, so don't hassle them.)
|
||||
if (keyBackupUploadActive) {
|
||||
logSpan.info("No default 4S key: setting state to SET_UP_RECOVERY");
|
||||
await this.setDeviceState("set_up_recovery", logSpan);
|
||||
} else {
|
||||
logSpan.info("No default 4S key but backup disabled: no toast needed");
|
||||
await this.setDeviceState("ok", logSpan);
|
||||
}
|
||||
logSpan.info("No default 4S key: setting state to SET_UP_RECOVERY");
|
||||
await this.setDeviceState("set_up_recovery", logSpan);
|
||||
} else {
|
||||
logSpan.warn("4S is missing secrets: setting state to KEY_STORAGE_OUT_OF_SYNC", {
|
||||
secretStorageStatus,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user