FIX: Display proper error message when changing a trust level fails

This commit is contained in:
Robin Ward
2014-07-29 15:54:20 -04:00
parent 55457810ba
commit ac4a33a656
2 changed files with 7 additions and 1 deletions
@@ -155,7 +155,11 @@ Discourse.AdminUser = Discourse.User.extend({
window.location.reload();
}, function(e) {
// failure
var error = I18n.t('admin.user.trust_level_change_failed', { error: "http: " + e.status + " - " + e.body });
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);
});
},