From c667ea69afba22620e0add944bdf0b4c22a5a184 Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Thu, 4 Jun 2020 13:47:43 -0600 Subject: [PATCH 1/3] Fix not being able to dismiss new login toasts `toastKey` is a thing. Fixes https://github.com/vector-im/riot-web/issues/13923 --- src/toasts/UnverifiedSessionToast.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/toasts/UnverifiedSessionToast.ts b/src/toasts/UnverifiedSessionToast.ts index 635356b9db..9dedd2b137 100644 --- a/src/toasts/UnverifiedSessionToast.ts +++ b/src/toasts/UnverifiedSessionToast.ts @@ -66,5 +66,5 @@ export const showToast = (deviceId: string) => { }; export const hideToast = (deviceId: string) => { - ToastStore.sharedInstance().dismissToast(deviceId); + ToastStore.sharedInstance().dismissToast(toastKey(deviceId)); }; From 3674b6446e4acddffdaf3a3c2c672f5bc53e810a Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Thu, 4 Jun 2020 13:53:09 -0600 Subject: [PATCH 2/3] Add a warning for dismissing invalid toasts --- src/stores/ToastStore.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/stores/ToastStore.ts b/src/stores/ToastStore.ts index 55c48c3937..3fa2f4b11f 100644 --- a/src/stores/ToastStore.ts +++ b/src/stores/ToastStore.ts @@ -68,6 +68,11 @@ export default class ToastStore extends EventEmitter { } dismissToast(key) { + if (!this.toasts.some(t => t.key === key)) { + console.warn(`No toast for ${key} found - cannot dismiss. Check your toastKey`); + return; + } + if (this.toasts[0] && this.toasts[0].key === key) { this.countSeen++; } From dc23dd637c8e10b680b86a2bff40225d266b0489 Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Thu, 4 Jun 2020 13:53:09 -0600 Subject: [PATCH 3/3] Revert "Add a warning for dismissing invalid toasts" This reverts commit 3674b6446e4acddffdaf3a3c2c672f5bc53e810a. --- src/stores/ToastStore.ts | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/stores/ToastStore.ts b/src/stores/ToastStore.ts index 3fa2f4b11f..55c48c3937 100644 --- a/src/stores/ToastStore.ts +++ b/src/stores/ToastStore.ts @@ -68,11 +68,6 @@ export default class ToastStore extends EventEmitter { } dismissToast(key) { - if (!this.toasts.some(t => t.key === key)) { - console.warn(`No toast for ${key} found - cannot dismiss. Check your toastKey`); - return; - } - if (this.toasts[0] && this.toasts[0].key === key) { this.countSeen++; }