When banning a user, a reason can be provided. The user will see this reason when trying to log in. Also log bans and unbans in the staff action logs.

This commit is contained in:
Neil Lalonde
2013-11-01 10:47:26 -04:00
parent 52b0c1c45f
commit 92a0729937
17 changed files with 180 additions and 26 deletions
@@ -142,21 +142,11 @@ Discourse.AdminUser = Discourse.User.extend({
return banned_at.format('L') + " - " + banned_till.format('L');
}.property('banned_till', 'banned_at'),
ban: function() {
var duration = parseInt(window.prompt(I18n.t('admin.user.ban_duration')), 10);
if (duration > 0) {
Discourse.ajax("/admin/users/" + this.id + "/ban", {
type: 'PUT',
data: {duration: duration}
}).then(function () {
// succeeded
window.location.reload();
}, function(e) {
// failure
var error = I18n.t('admin.user.ban_failed', { error: "http: " + e.status + " - " + e.body });
bootbox.alert(error);
});
}
ban: function(duration, reason) {
return Discourse.ajax("/admin/users/" + this.id + "/ban", {
type: 'PUT',
data: {duration: duration, reason: reason}
});
},
unban: function() {