FEATURE: Allow admins to lock users from TL3 promotion/demotion

Also, update the display logic for the leader promotion screen to
account for the demotion grace period.
This commit is contained in:
riking
2014-09-13 13:55:26 -07:00
committed by Sam
parent 41d53c7222
commit c8111ada6e
12 changed files with 121 additions and 18 deletions

View File

@@ -164,6 +164,24 @@ Discourse.AdminUser = Discourse.User.extend({
this.set('trustLevel.id', this.get('originalTrustLevel'));
},
lockTrustLevel: function(locked) {
Discourse.ajax("/admin/users/" + this.id + "/trust_level_lock", {
type: 'PUT',
data: { locked: !!locked }
}).then(function() {
// succeeded
window.location.reload();
}, function(e) {
// failure
var error;
if (e.responseJSON && e.responseJSON.errors) {
error = e.responseJSON.errors[0];
}
error = error || I18n.t('admin.user.trust_level_change_failed', { error: "http: " + e.status + " - " + e.body });
bootbox.alert(error);
});
},
isSuspended: Em.computed.equal('suspended', true),
canSuspend: Em.computed.not('staff'),