mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
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:
@@ -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) {
|
||||
|
||||
@@ -408,6 +408,21 @@
|
||||
</div>
|
||||
{{/if}}
|
||||
|
||||
{{#if model.tl3_requirements.penalty_counts.total}}
|
||||
<div class='display-row clear-penalty-history'>
|
||||
<div class='field'>{{i18n 'admin.user.penalty_count'}}</div>
|
||||
<div class='value'>{{model.tl3_requirements.penalty_counts.total}}</div>
|
||||
{{#if currentUser.admin}}
|
||||
<div class='controls'>
|
||||
{{d-button label="admin.user.clear_penalty_history.title"
|
||||
icon="times"
|
||||
action=(action "clearPenaltyHistory")}}
|
||||
{{i18n "admin.user.clear_penalty_history.description"}}
|
||||
</div>
|
||||
{{/if}}
|
||||
</div>
|
||||
{{/if}}
|
||||
|
||||
</section>
|
||||
|
||||
{{#if currentUser.admin}}
|
||||
|
||||
Reference in New Issue
Block a user