From 270a8d787d22a22f9df147d9383fb12067cbefb7 Mon Sep 17 00:00:00 2001 From: Andy Balaam Date: Mon, 30 Mar 2026 15:43:57 +0100 Subject: [PATCH] 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. --- .../DeviceListenerCurrentDevice.ts | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/apps/web/src/device-listener/DeviceListenerCurrentDevice.ts b/apps/web/src/device-listener/DeviceListenerCurrentDevice.ts index fbf7833058..74c83d947e 100644 --- a/apps/web/src/device-listener/DeviceListenerCurrentDevice.ts +++ b/apps/web/src/device-listener/DeviceListenerCurrentDevice.ts @@ -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,