From 1e6f17537917421cc4720afaa460bb273afab846 Mon Sep 17 00:00:00 2001 From: Franz Liedke Date: Wed, 14 Aug 2019 08:27:06 +0200 Subject: [PATCH] Extract real method Refs #1750, #1788. --- js/src/forum/utils/UserControls.js | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/js/src/forum/utils/UserControls.js b/js/src/forum/utils/UserControls.js index 07fb89090..0e59ce834 100644 --- a/js/src/forum/utils/UserControls.js +++ b/js/src/forum/utils/UserControls.js @@ -100,25 +100,25 @@ export default { return; } - const showAlert = type => { - const { username, email } = this.data.attributes; - - app.alerts.show(new Alert({ - type, - children: app.translator.trans( - `core.forum.user.delete_alert_${type}`, { username, email } - ) - })); - }; - this.delete().then(() => { - showAlert('success'); + this.showDeletionAlert('success'); if (app.current instanceof UserPage && app.current.user === this) { app.history.back(); } else { window.location.reload(); } - }).catch(() => showAlert('error')); + }).catch(() => this.showDeletionAlert('error')); + }, + + showDeletionAlert(type) { + const { username, email } = this.data.attributes; + + app.alerts.show(new Alert({ + type, + children: app.translator.trans( + `core.forum.user.delete_alert_${type}`, { username, email } + ) + })); }, /**