mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-25 00:29:30 -05:00
27 lines
715 B
JavaScript
27 lines
715 B
JavaScript
|
/**
|
||
|
The modal for banning a user.
|
||
|
|
||
|
@class AdminBanUserController
|
||
|
@extends Discourse.Controller
|
||
|
@namespace Discourse
|
||
|
@uses Discourse.ModalFunctionality
|
||
|
@module Discourse
|
||
|
**/
|
||
|
Discourse.AdminBanUserController = Discourse.ObjectController.extend(Discourse.ModalFunctionality, {
|
||
|
|
||
|
actions: {
|
||
|
ban: function() {
|
||
|
var duration = parseInt(this.get('duration'), 10);
|
||
|
if (duration > 0) {
|
||
|
this.get('model').ban(duration, this.get('reason')).then(function() {
|
||
|
window.location.reload();
|
||
|
}, function(e) {
|
||
|
var error = I18n.t('admin.user.ban_failed', { error: "http: " + e.status + " - " + e.body });
|
||
|
bootbox.alert(error);
|
||
|
});
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
});
|