Simplify DeviceListener logic: consider recovery disabled if backup is disabled (#32979)
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:
@@ -161,8 +161,6 @@ export class DeviceListenerCurrentDevice {
|
|||||||
|
|
||||||
const recoveryDisabled = await this.recheckRecoveryDisabled(this.client);
|
const recoveryDisabled = await this.recheckRecoveryDisabled(this.client);
|
||||||
|
|
||||||
const recoveryIsOk = secretStorageStatus.ready || recoveryDisabled;
|
|
||||||
|
|
||||||
const isCurrentDeviceTrusted = Boolean(
|
const isCurrentDeviceTrusted = Boolean(
|
||||||
(await crypto.getDeviceVerificationStatus(this.client.getSafeUserId(), this.client.deviceId!))
|
(await crypto.getDeviceVerificationStatus(this.client.getSafeUserId(), this.client.deviceId!))
|
||||||
?.crossSigningVerified,
|
?.crossSigningVerified,
|
||||||
@@ -171,6 +169,8 @@ export class DeviceListenerCurrentDevice {
|
|||||||
const keyBackupUploadActive = await this.isKeyBackupUploadActive(logSpan);
|
const keyBackupUploadActive = await this.isKeyBackupUploadActive(logSpan);
|
||||||
const backupDisabled = await this.recheckBackupDisabled();
|
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
|
// We warn if key backup upload is turned off and we have not explicitly
|
||||||
// said we are OK with that.
|
// said we are OK with that.
|
||||||
const keyBackupUploadIsOk = keyBackupUploadActive || backupDisabled;
|
const keyBackupUploadIsOk = keyBackupUploadActive || backupDisabled;
|
||||||
@@ -215,16 +215,8 @@ export class DeviceListenerCurrentDevice {
|
|||||||
await this.setDeviceState("turn_on_key_storage", logSpan);
|
await this.setDeviceState("turn_on_key_storage", logSpan);
|
||||||
} else if (!recoveryIsOk) {
|
} else if (!recoveryIsOk) {
|
||||||
if (secretStorageStatus.defaultKeyId === null) {
|
if (secretStorageStatus.defaultKeyId === null) {
|
||||||
// The user just hasn't set up 4S yet: if they have key
|
logSpan.info("No default 4S key: setting state to SET_UP_RECOVERY");
|
||||||
// backup, prompt them to turn on recovery too. (If not, they
|
await this.setDeviceState("set_up_recovery", logSpan);
|
||||||
// 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);
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
logSpan.warn("4S is missing secrets: setting state to KEY_STORAGE_OUT_OF_SYNC", {
|
logSpan.warn("4S is missing secrets: setting state to KEY_STORAGE_OUT_OF_SYNC", {
|
||||||
secretStorageStatus,
|
secretStorageStatus,
|
||||||
|
|||||||
Reference in New Issue
Block a user