FIX: displayErrors is undefined in flags.js controller

This commit is contained in:
Neil Lalonde 2014-05-21 12:19:27 -04:00
parent 68747c8d2d
commit 7061f6a570
1 changed files with 6 additions and 2 deletions

View File

@ -90,8 +90,12 @@ export default Discourse.ObjectController.extend(Discourse.ModalFunctionality, {
postAction.act(params).then(function() {
self.send('closeModal');
}, function(errors) {
self.send('showModal');
self.displayErrors(errors);
self.send('closeModal');
if (errors && errors.responseText) {
bootbox.alert($.parseJSON(errors.responseText).errors);
} else {
bootbox.alert(I18n.t('generic_error'));
}
});
},