Merge branch 'master' of github.com:discourse/discourse

This commit is contained in:
Robin Ward 2013-08-14 12:04:51 -04:00
commit 803f5d85ee
3 changed files with 24 additions and 8 deletions

View file

@ -9,11 +9,26 @@
Discourse.AdminUser = Discourse.User.extend({ Discourse.AdminUser = Discourse.User.extend({
deleteAllPosts: function() { deleteAllPosts: function() {
var user = this;
this.set('can_delete_all_posts', false); this.set('can_delete_all_posts', false);
Discourse.ajax("/admin/users/" + (this.get('id')) + "/delete_all_posts", {type: 'PUT'}).then(function(result){ var user = this;
user.set('post_count', 0); var message = I18n.t('admin.user.delete_all_posts_confirm', {posts: user.get('post_count'), topics: user.get('topic_count')});
}); var buttons = [{
"label": I18n.t("composer.cancel"),
"class": "cancel",
"link": true,
"callback": function() {
user.set('can_delete_all_posts', true);
}
}, {
"label": '<i class="icon icon-warning-sign"></i> ' + I18n.t("admin.user.delete_all_posts"),
"class": "btn btn-danger",
"callback": function() {
Discourse.ajax("/admin/users/" + (user.get('id')) + "/delete_all_posts", {type: 'PUT'}).then(function(result){
user.set('post_count', 0);
});
}
}];
bootbox.dialog(message, buttons, {"classes": "delete-all-posts"});
}, },
// Revoke the user's admin access // Revoke the user's admin access
@ -248,13 +263,13 @@ Discourse.AdminUser = Discourse.User.extend({
"class": "cancel", "class": "cancel",
"link": true "link": true
}, { }, {
"label": I18n.t('admin.user.delete_dont_block'), "label": '<i class="icon icon-warning-sign"></i> ' + I18n.t('admin.user.delete_dont_block'),
"class": "btn", "class": "btn",
"callback": function(){ "callback": function(){
performDestroy(false); performDestroy(false);
} }
}, { }, {
"label": I18n.t('admin.user.delete_and_block'), "label": '<i class="icon icon-warning-sign"></i> ' + I18n.t('admin.user.delete_and_block'),
"class": "btn", "class": "btn",
"callback": function(){ "callback": function(){
performDestroy(true); performDestroy(true);
@ -272,7 +287,7 @@ Discourse.AdminUser = Discourse.User.extend({
"class": "cancel", "class": "cancel",
"link": true "link": true
}, { }, {
"label": I18n.t("flagging.yes_delete_spammer"), "label": '<i class="icon icon-warning-sign"></i> ' + I18n.t("flagging.yes_delete_spammer"),
"class": "btn btn-danger", "class": "btn btn-danger",
"callback": function() { "callback": function() {
Discourse.ajax("/admin/users/" + user.get('id') + '.json', { Discourse.ajax("/admin/users/" + user.get('id') + '.json', {

View file

@ -313,7 +313,7 @@
} }
} }
.flagging-delete-spammer { .flagging-delete-spammer, .delete-all-posts {
.modal-footer .cancel { .modal-footer .cancel {
text-decoration: underline; text-decoration: underline;
margin-left: 10px; margin-left: 10px;

View file

@ -1247,6 +1247,7 @@ en:
unban_failed: "Something went wrong unbanning this user {{error}}" unban_failed: "Something went wrong unbanning this user {{error}}"
ban_duration: "How long would you like to ban the user for? (days)" ban_duration: "How long would you like to ban the user for? (days)"
delete_all_posts: "Delete all posts" delete_all_posts: "Delete all posts"
delete_all_posts_confirm: "You are about to delete %{posts} posts and %{topics} topics. Are you sure?"
ban: "Ban" ban: "Ban"
unban: "Unban" unban: "Unban"
banned: "Banned?" banned: "Banned?"