mirror of
https://github.com/flarum/framework.git
synced 2025-02-06 11:51:45 +08:00
parent
fcb3921a42
commit
be6d42d46f
|
@ -92,7 +92,7 @@ export default class History {
|
|||
|
||||
this.stack.pop();
|
||||
|
||||
m.route(this.getCurrent().url);
|
||||
this.canGoBack() ? m.route(this.getCurrent().url) : this.home();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import Alert from '../../common/components/Alert';
|
||||
import Button from '../../common/components/Button';
|
||||
import Separator from '../../common/components/Separator';
|
||||
import EditUserModal from '../components/EditUserModal';
|
||||
|
@ -95,15 +96,29 @@ export default {
|
|||
* Delete the user.
|
||||
*/
|
||||
deleteAction() {
|
||||
if (confirm(app.translator.trans('core.forum.user_controls.delete_confirmation'))) {
|
||||
this.delete().then(() => {
|
||||
if (app.current instanceof UserPage && app.current.user === this) {
|
||||
app.history.back();
|
||||
} else {
|
||||
window.location.reload();
|
||||
}
|
||||
});
|
||||
if (!confirm(app.translator.trans('core.forum.user_controls.delete_confirmation'))) {
|
||||
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');
|
||||
if (app.current instanceof UserPage && app.current.user === this) {
|
||||
app.history.back();
|
||||
} else {
|
||||
window.location.reload();
|
||||
}
|
||||
}).catch(() => showAlert('error'));
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue
Block a user