FEATURE: Ability to clear a user's penalty history

You can do this manually if you want to allow them to reach TL3 without
their penalty history counting against them.
This commit is contained in:
Robin Ward
2018-05-25 11:45:42 -04:00
parent c658fb6e31
commit 4195c7c9ea
7 changed files with 120 additions and 0 deletions

View File

@ -103,6 +103,16 @@ export default Ember.Controller.extend(CanCheckEmails, {
anonymize() { return this.get('model').anonymize(); },
disableSecondFactor() { return this.get('model').disableSecondFactor(); },
clearPenaltyHistory() {
let user = this.get('model');
return ajax(`/admin/users/${user.get('id')}/penalty_history`, {
type: 'DELETE'
}).then(() => {
user.set('tl3_requirements.penalty_counts.total', 0);
}).catch(popupAjaxError);
},
destroy() {
const postCount = this.get('model.post_count');
if (postCount <= 5) {