fix undismissable toasts

pull/21833/head
Bruno Windels 2020-03-27 16:45:46 +01:00
parent cf4f595f79
commit 29bb7e38fe
1 changed files with 67 additions and 71 deletions

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());
@ -205,3 +200,4 @@ export default class DeviceListener {
this._activeNagToasts = newActiveToasts;
}
}
}