Merge pull request #4291 from matrix-org/bwindels/fixcantdismissdevicetoast

Fix: can't dismiss unverified session toast when encryption hasn't been upgraded
This commit is contained in:
J. Ryan Stinnett 2020-03-27 16:14:58 +00:00 committed by GitHub
commit 7bdd22ae03
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -119,12 +119,10 @@ export default class DeviceListener {
const crossSigningReady = await cli.isCrossSigningReady();
if (!crossSigningReady) {
if (this._dismissedThisDeviceToast) {
ToastStore.sharedInstance().dismissToast(THIS_DEVICE_TOAST_KEY);
return;
}
} else {
if (!crossSigningReady) {
// cross signing isn't enabled - nag to enable it
// There are 3 different toasts for:
if (cli.getStoredCrossSigningForUser(cli.getUserId())) {
@ -160,11 +158,6 @@ export default class DeviceListener {
}
return;
} else if (await cli.secretStorageKeyNeedsUpgrade()) {
if (this._dismissedThisDeviceToast) {
ToastStore.sharedInstance().dismissToast(THIS_DEVICE_TOAST_KEY);
return;
}
ToastStore.sharedInstance().addOrReplaceToast({
key: THIS_DEVICE_TOAST_KEY,
title: _t("Encryption upgrade available"),
@ -172,10 +165,12 @@ export default class DeviceListener {
props: {kind: 'upgrade_ssss'},
component: sdk.getComponent("toasts.SetupEncryptionToast"),
});
} else {
ToastStore.sharedInstance().dismissToast(THIS_DEVICE_TOAST_KEY);
}
}
// as long as cross-signing isn't ready,
// you can't see or dismiss any device toasts
if (crossSigningReady) {
const newActiveToasts = new Set();
const devices = await cli.getStoredDevicesForUser(cli.getUserId());
@ -204,4 +199,5 @@ export default class DeviceListener {
}
this._activeNagToasts = newActiveToasts;
}
}
}