From 6fb257df7a0f428090bd1816bb475992578b616f Mon Sep 17 00:00:00 2001 From: David Baker Date: Thu, 23 Jul 2020 17:33:14 +0100 Subject: [PATCH] Add dismiss button to rebrand toast Fixes https://github.com/vector-im/riot-web/issues/14575 --- src/RebrandListener.tsx | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/RebrandListener.tsx b/src/RebrandListener.tsx index 283f74d743..47b883cf35 100644 --- a/src/RebrandListener.tsx +++ b/src/RebrandListener.tsx @@ -114,6 +114,11 @@ export default class RebrandListener { } }; + onOneTimeToastDismiss = async () => { + localStorage.setItem('mx_rename_dialog_dismissed', 'true'); + this.recheck(); + }; + onNagTimerFired = () => { this._reshowTimer = null; this.nagAgainAt = null; @@ -143,10 +148,14 @@ export default class RebrandListener { if (nagToast || oneTimeToast) { let description; + let rejectLabel = null; + let onReject = null; if (nagToast) { description = _t("Use your account to sign in to the latest version"); } else { description = _t("We’re excited to announce Riot is now Element"); + rejectLabel = _t("Dismiss"); + onReject = this.onOneTimeToastDismiss; } ToastStore.sharedInstance().addOrReplaceToast({ @@ -157,6 +166,8 @@ export default class RebrandListener { description, acceptLabel: _t("Learn More"), onAccept: nagToast ? this.onNagToastLearnMore : this.onOneTimeToastLearnMore, + rejectLabel, + onReject, }, component: GenericToast, priority: 20,