From f9e5aa4193f1491f4d33a2c26b3348dd18366d01 Mon Sep 17 00:00:00 2001 From: Franz Liedke Date: Fri, 18 Sep 2020 18:09:56 +0200 Subject: [PATCH] Email confirmation alert: Simplify implementation Now that we don't mess with component instances anymore, we can follow normal Mithril patterns. --- js/src/forum/utils/alertEmailConfirmation.js | 36 +++++++------------- 1 file changed, 13 insertions(+), 23 deletions(-) diff --git a/js/src/forum/utils/alertEmailConfirmation.js b/js/src/forum/utils/alertEmailConfirmation.js index a5610a7a7..9f158271c 100644 --- a/js/src/forum/utils/alertEmailConfirmation.js +++ b/js/src/forum/utils/alertEmailConfirmation.js @@ -18,15 +18,15 @@ export default function alertEmailConfirmation(app) { super.oninit(vnode); this.loading = false; - this.disabled = false; - - this.content = app.translator.trans('core.forum.user_email_confirmation.resend_button'); + this.sent = false; } view() { return ( - ); } @@ -42,8 +42,7 @@ export default function alertEmailConfirmation(app) { }) .then(() => { this.loading = false; - this.content = [icon('fas fa-check'), ' ', app.translator.trans('core.forum.user_email_confirmation.sent_message')]; - this.disabled = true; + this.sent = true; m.redraw(); }) .catch(() => { @@ -53,22 +52,13 @@ export default function alertEmailConfirmation(app) { } } - class ContainedAlert extends Alert { - view(vnode) { - const vdom = super.view(vnode); - - return { ...vdom, children: [
{vdom.children}
] }; - } - } - m.mount($('
').insertBefore('#content')[0], { - view: () => - ContainedAlert.component( - { - dismissible: false, - controls: [ResendButton.component()], - }, - app.translator.trans('core.forum.user_email_confirmation.alert_message', { email: {user.email()} }) - ), + view: () => ( + ]}> +
+ {app.translator.trans('core.forum.user_email_confirmation.alert_message', { email: {user.email()} })} +
+
+ ), }); }