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(); const crossSigningReady = await cli.isCrossSigningReady();
if (!crossSigningReady) {
if (this._dismissedThisDeviceToast) { if (this._dismissedThisDeviceToast) {
ToastStore.sharedInstance().dismissToast(THIS_DEVICE_TOAST_KEY); ToastStore.sharedInstance().dismissToast(THIS_DEVICE_TOAST_KEY);
return; } else {
} if (!crossSigningReady) {
// cross signing isn't enabled - nag to enable it // cross signing isn't enabled - nag to enable it
// There are 3 different toasts for: // There are 3 different toasts for:
if (cli.getStoredCrossSigningForUser(cli.getUserId())) { if (cli.getStoredCrossSigningForUser(cli.getUserId())) {
@ -160,11 +158,6 @@ export default class DeviceListener {
} }
return; return;
} else if (await cli.secretStorageKeyNeedsUpgrade()) { } else if (await cli.secretStorageKeyNeedsUpgrade()) {
if (this._dismissedThisDeviceToast) {
ToastStore.sharedInstance().dismissToast(THIS_DEVICE_TOAST_KEY);
return;
}
ToastStore.sharedInstance().addOrReplaceToast({ ToastStore.sharedInstance().addOrReplaceToast({
key: THIS_DEVICE_TOAST_KEY, key: THIS_DEVICE_TOAST_KEY,
title: _t("Encryption upgrade available"), title: _t("Encryption upgrade available"),
@ -172,10 +165,12 @@ export default class DeviceListener {
props: {kind: 'upgrade_ssss'}, props: {kind: 'upgrade_ssss'},
component: sdk.getComponent("toasts.SetupEncryptionToast"), 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 newActiveToasts = new Set();
const devices = await cli.getStoredDevicesForUser(cli.getUserId()); const devices = await cli.getStoredDevicesForUser(cli.getUserId());
@ -205,3 +200,4 @@ export default class DeviceListener {
this._activeNagToasts = newActiveToasts; this._activeNagToasts = newActiveToasts;
} }
} }
}