diff --git a/app/assets/javascripts/admin/controllers/admin-user-index.js.es6 b/app/assets/javascripts/admin/controllers/admin-user-index.js.es6 index d218bbe10..89e4c2441 100644 --- a/app/assets/javascripts/admin/controllers/admin-user-index.js.es6 +++ b/app/assets/javascripts/admin/controllers/admin-user-index.js.es6 @@ -92,6 +92,14 @@ export default ObjectController.extend(CanCheckEmails, { self.get('model').revokeApiKey(); } }); + }, + + anonymize: function() { + this.get('model').anonymize(); + }, + + destroy: function() { + this.get('model').destroy(); } } diff --git a/app/assets/javascripts/admin/models/admin_user.js b/app/assets/javascripts/admin/models/admin_user.js index 7e66e278a..b2d6c1a17 100644 --- a/app/assets/javascripts/admin/models/admin_user.js +++ b/app/assets/javascripts/admin/models/admin_user.js @@ -336,7 +336,6 @@ Discourse.AdminUser = Discourse.User.extend({ var performAnonymize = function() { Discourse.ajax("/admin/users/" + user.get('id') + '/anonymize.json', {type: 'PUT'}).then(function(data) { if (data.success) { - bootbox.alert(I18n.t("admin.user.anonymize_successful")); if (data.username) { document.location = "/admin/users/" + data.username; } else { diff --git a/app/assets/javascripts/admin/templates/user_index.hbs b/app/assets/javascripts/admin/templates/user_index.hbs index bd25465e1..2546f3ae2 100644 --- a/app/assets/javascripts/admin/templates/user_index.hbs +++ b/app/assets/javascripts/admin/templates/user_index.hbs @@ -450,17 +450,27 @@

- +
+ {{#unless anonymizeForbidden}} + {{d-button label="admin.user.anonymize" + icon="exclamation-triangle" + class="btn btn-danger" + disabled=anonymizeForbidden + action="anonymize"}} + {{/unless}} + + {{#unless deleteForbidden}} + {{d-button label="admin.user.delete" + icon="exclamation-triangle" + class="btn btn-danger" + disabled=deleteForbidden + action="destroy"}} + {{/unless}} +
- {{#if deleteExplanation}}
+
{{deleteExplanation}}
{{/if}}
diff --git a/config/locales/client.en.yml b/config/locales/client.en.yml index 900716fb8..27c7cd825 100644 --- a/config/locales/client.en.yml +++ b/config/locales/client.en.yml @@ -2052,7 +2052,6 @@ en: anonymize: "Anonymize User" anonymize_confirm: "Are you SURE you want to anonymize this account? This will change the username and email, and reset all profile information." anonymize_yes: "Yes, anonymize this account" - anonymize_successful: "The user was anonymized successfully." anonymize_failed: "There was a problem anonymizing the account." delete: "Delete User" delete_forbidden_because_staff: "Admins and moderators can't be deleted."