From e7cdd497ddef1409d5dcede07b084b8be000380c 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. --- .../core/js/src/forum/utils/UserControls.js | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/framework/core/js/src/forum/utils/UserControls.js b/framework/core/js/src/forum/utils/UserControls.js index 07fb89090..0e59ce834 100644 --- a/framework/core/js/src/forum/utils/UserControls.js +++ b/framework/core/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 } + ) + })); }, /**