FIX: reload current page when deleting a user

This commit is contained in:
Régis Hanol 2014-12-03 16:03:42 +01:00
parent 77a775ecd2
commit b4363de280
3 changed files with 7 additions and 6 deletions

View File

@ -314,9 +314,10 @@ Discourse.AdminUser = Discourse.User.extend({
destroy: function(opts) {
var user = this;
var location = document.location.pathname;
var performDestroy = function(block) {
var formData = { context: window.location.pathname };
var formData = { context: location };
if (block) {
formData["block_email"] = true;
formData["block_urls"] = true;
@ -330,7 +331,7 @@ Discourse.AdminUser = Discourse.User.extend({
data: formData
}).then(function(data) {
if (data.deleted) {
document.location = "/admin/users/list/active";
document.location = location;
} else {
bootbox.alert(I18n.t("admin.user.delete_failed"));
if (data.user) {

View File

@ -9,6 +9,10 @@ export default Discourse.Route.extend({
bootbox.alert(I18n.t("admin.export_csv.failed"));
}
});
},
deleteUser: function(user) {
Discourse.AdminUser.create(user).destroy({ deletePosts: true });
}
}

View File

@ -98,10 +98,6 @@ export default ObjectController.extend({
postStream.cancelFilter();
postStream.refresh();
this.close();
},
deleteUser: function(user) {
user.destroy({ deletePosts: true });
}
}