Different dialog for new trusted backup
Split the 'new recovery method' into two cases: one where the new recovery method isn't trusted and you need to verify the device, and another where it is and the client is using it (where it's more of an FYI). https://github.com/vector-im/riot-web/issues/8069
This commit is contained in:
parent
e0bc0494fa
commit
d87d00e4ae
3 changed files with 83 additions and 42 deletions
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
Copyright 2015, 2016 OpenMarket Ltd
|
||||
Copyright 2017 Vector Creations Ltd
|
||||
Copyright 2017, 2018 New Vector Ltd
|
||||
Copyright 2017-2019 New Vector Ltd
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
|
@ -1447,20 +1447,32 @@ export default React.createClass({
|
|||
break;
|
||||
}
|
||||
});
|
||||
cli.on("crypto.keyBackupFailed", (errcode) => {
|
||||
switch (errcode) {
|
||||
case 'M_NOT_FOUND':
|
||||
Modal.createTrackedDialogAsync('Recovery Method Removed', 'Recovery Method Removed',
|
||||
import('../../async-components/views/dialogs/keybackup/RecoveryMethodRemovedDialog'),
|
||||
);
|
||||
cli.on("crypto.keyBackupFailed", async (errcode) => {
|
||||
let haveNewVersion;
|
||||
let newVersionInfo;
|
||||
// if key backup is still enabled, there must be a new backup in place
|
||||
if (MatrixClientPeg.get().getKeyBackupEnabled()) {
|
||||
haveNewVersion = true;
|
||||
} else {
|
||||
// otherwise check the server to see if there's a new one
|
||||
try {
|
||||
newVersionInfo = await MatrixClientPeg.get().getKeyBackupVersion();
|
||||
if (newVersionInfo !== null) haveNewVersion = true;
|
||||
} catch (e) {
|
||||
console.error("Saw key backup error but failed to check backup version!", e);
|
||||
return;
|
||||
case 'M_WRONG_ROOM_KEYS_VERSION':
|
||||
Modal.createTrackedDialogAsync('New Recovery Method', 'New Recovery Method',
|
||||
import('../../async-components/views/dialogs/keybackup/NewRecoveryMethodDialog'),
|
||||
);
|
||||
return;
|
||||
default:
|
||||
console.error(`Invalid key backup failure code: ${errcode}`);
|
||||
}
|
||||
}
|
||||
|
||||
if (haveNewVersion) {
|
||||
Modal.createTrackedDialogAsync('New Recovery Method', 'New Recovery Method',
|
||||
import('../../async-components/views/dialogs/keybackup/NewRecoveryMethodDialog'),
|
||||
{ newVersionInfo }
|
||||
);
|
||||
} else {
|
||||
Modal.createTrackedDialogAsync('Recovery Method Removed', 'Recovery Method Removed',
|
||||
import('../../async-components/views/dialogs/keybackup/RecoveryMethodRemovedDialog'),
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue