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:
commit
7bdd22ae03
1 changed files with 67 additions and 71 deletions
|
@ -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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue