From b484bc5e098e72b09d8904042f4cf67540c304db Mon Sep 17 00:00:00 2001 From: "J. Ryan Stinnett" Date: Fri, 4 Sep 2020 13:52:14 +0100 Subject: [PATCH] Rearrange backup status to always have advanced --- .../views/settings/SecureBackupPanel.js | 68 ++++++++++--------- src/i18n/strings/en_EN.json | 6 +- 2 files changed, 38 insertions(+), 36 deletions(-) diff --git a/src/components/views/settings/SecureBackupPanel.js b/src/components/views/settings/SecureBackupPanel.js index ec345f6317..93e28c8bc9 100644 --- a/src/components/views/settings/SecureBackupPanel.js +++ b/src/components/views/settings/SecureBackupPanel.js @@ -165,24 +165,28 @@ export default class SecureBackupPanel extends React.PureComponent { render() { const Spinner = sdk.getComponent("elements.Spinner"); const AccessibleButton = sdk.getComponent("elements.AccessibleButton"); - const featureDescription = _t( - "Back up your encryption keys with your account data in case you " + - "lose access to your sessions. Your keys will be secured with a " + - "unique Recovery Key.", - ); + + const { + loading, + error, + backupInfo, + backupSigStatus, + backupKeyStored, + sessionsRemaining, + } = this.state; let statusDescription; - let details; + let extraDetails; let actions; - if (this.state.error) { + if (error) { statusDescription = (
{_t("Unable to load key backup status")}
); - } else if (this.state.loading) { + } else if (loading) { statusDescription = ; - } else if (this.state.backupInfo) { + } else if (backupInfo) { let restoreButtonCaption = _t("Restore from Backup"); if (MatrixClientPeg.get().getKeyBackupEnabled()) { @@ -203,15 +207,7 @@ export default class SecureBackupPanel extends React.PureComponent { restoreButtonCaption = _t("Connect this session to Key Backup"); } - let keyStatus; - if (this.state.backupKeyStored === true) { - keyStatus = _t("in secret storage"); - } else { - keyStatus = _t("not stored"); - } - let uploadStatus; - const { sessionsRemaining } = this.state; if (!MatrixClientPeg.get().getKeyBackupEnabled()) { // No upload status to show when backup disabled. uploadStatus = ""; @@ -225,7 +221,7 @@ export default class SecureBackupPanel extends React.PureComponent { ; } - let backupSigStatuses = this.state.backupSigStatus.sigs.map((sig, i) => { + let backupSigStatuses = backupSigStatus.sigs.map((sig, i) => { const deviceName = sig.device ? (sig.device.getDisplayName() || sig.device.deviceId) : null; const validity = sub => @@ -306,12 +302,12 @@ export default class SecureBackupPanel extends React.PureComponent { {sigStatus} ; }); - if (this.state.backupSigStatus.sigs.length === 0) { + if (backupSigStatus.sigs.length === 0) { backupSigStatuses = _t("Backup is not signed by any of your sessions"); } let trustedLocally; - if (this.state.backupSigStatus.trusted_locally) { + if (backupSigStatus.trusted_locally) { trustedLocally = _t("This backup is trusted because it has been restored on this session"); } @@ -322,17 +318,13 @@ export default class SecureBackupPanel extends React.PureComponent { ; } - details = ( -
- {_t("Advanced")} -
{_t("Backup version: ")}{this.state.backupInfo.version}
-
{_t("Algorithm: ")}{this.state.backupInfo.algorithm}
-
{_t("Backup key stored: ")}{keyStatus}
- {uploadStatus} -
{backupSigStatuses}
-
{trustedLocally}
-
- ); + extraDetails = <> +
{_t("Backup version: ")}{backupInfo.version}
+
{_t("Algorithm: ")}{backupInfo.algorithm}
+ {uploadStatus} +
{backupSigStatuses}
+
{trustedLocally}
+ ; actions = (
@@ -361,9 +353,19 @@ export default class SecureBackupPanel extends React.PureComponent { return (
-

{featureDescription}

+

{_t( + "Back up your encryption keys with your account data in case you " + + "lose access to your sessions. Your keys will be secured with a " + + "unique Recovery Key.", + )}

{statusDescription} - {details} +
+ {_t("Advanced")} +
{_t("Backup key stored: ")}{ + backupKeyStored === true ? _t("in secret storage") : _t("not stored") + }
+ {extraDetails} +
{actions}
); diff --git a/src/i18n/strings/en_EN.json b/src/i18n/strings/en_EN.json index 843373ad07..49e8b1d2e8 100644 --- a/src/i18n/strings/en_EN.json +++ b/src/i18n/strings/en_EN.json @@ -730,14 +730,12 @@ "Save": "Save", "Delete Backup": "Delete Backup", "Are you sure? You will lose your encrypted messages if your keys are not backed up properly.": "Are you sure? You will lose your encrypted messages if your keys are not backed up properly.", - "Back up your encryption keys with your account data in case you lose access to your sessions. Your keys will be secured with a unique Recovery Key.": "Back up your encryption keys with your account data in case you lose access to your sessions. Your keys will be secured with a unique Recovery Key.", "Unable to load key backup status": "Unable to load key backup status", "Restore from Backup": "Restore from Backup", "This session is backing up your keys. ": "This session is backing up your keys. ", "This session is not backing up your keys, but you do have an existing backup you can restore from and add to going forward.": "This session is not backing up your keys, but you do have an existing backup you can restore from and add to going forward.", "Connect this session to key backup before signing out to avoid losing any keys that may only be on this session.": "Connect this session to key backup before signing out to avoid losing any keys that may only be on this session.", "Connect this session to Key Backup": "Connect this session to Key Backup", - "not stored": "not stored", "Backing up %(sessionsRemaining)s keys...": "Backing up %(sessionsRemaining)s keys...", "All keys backed up": "All keys backed up", "Backup has a valid signature from this user": "Backup has a valid signature from this user", @@ -754,10 +752,12 @@ "This backup is trusted because it has been restored on this session": "This backup is trusted because it has been restored on this session", "Backup version: ": "Backup version: ", "Algorithm: ": "Algorithm: ", - "Backup key stored: ": "Backup key stored: ", "Your keys are not being backed up from this session.": "Your keys are not being backed up from this session.", "Back up your keys before signing out to avoid losing them.": "Back up your keys before signing out to avoid losing them.", "Start using Key Backup": "Start using Key Backup", + "Back up your encryption keys with your account data in case you lose access to your sessions. Your keys will be secured with a unique Recovery Key.": "Back up your encryption keys with your account data in case you lose access to your sessions. Your keys will be secured with a unique Recovery Key.", + "Backup key stored: ": "Backup key stored: ", + "not stored": "not stored", "Identity Server URL must be HTTPS": "Identity Server URL must be HTTPS", "Not a valid Identity Server (status code %(code)s)": "Not a valid Identity Server (status code %(code)s)", "Could not connect to Identity Server": "Could not connect to Identity Server",