mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-24 19:33:02 +03:00
WIP: review uses of notifications.showErrors
issue #5409 `notifications.showErrors` was historically used to display multiple error notifications whether from validation errors or responses form the API. This usage needs to be reviewed as inline validations should handle the validation side and we should be displaying alerts for actual errors. Eventually `notifications.showErrors` should be left unused and therefore removed.
This commit is contained in:
parent
7ab232e770
commit
61e5ebdd2f
@ -16,7 +16,7 @@ export default Ember.Controller.extend({
|
||||
self.store.unloadAll('post');
|
||||
self.store.unloadAll('tag');
|
||||
}).catch(function (response) {
|
||||
self.get('notifications').showErrors(response);
|
||||
self.get('notifications').showAPIError(response);
|
||||
});
|
||||
},
|
||||
|
||||
|
@ -78,6 +78,10 @@ export default Ember.Controller.extend({
|
||||
}
|
||||
}).catch(function (errors) {
|
||||
newUser.deleteRecord();
|
||||
// TODO: user model includes ValidationEngine mixin so
|
||||
// save is overridden in order to validate, we probably
|
||||
// want to use inline-validations here and only show an
|
||||
// alert if we have an actual error
|
||||
self.get('notifications').showErrors(errors);
|
||||
});
|
||||
}
|
||||
|
@ -12,7 +12,7 @@ export default Ember.Controller.extend({
|
||||
this.get('model').save().then(function (model) {
|
||||
return model;
|
||||
}).catch(function (err) {
|
||||
notifications.showErrors(err);
|
||||
notifications.showAPIError(err);
|
||||
});
|
||||
},
|
||||
|
||||
|
@ -33,8 +33,8 @@ export default Ember.Controller.extend(ValidationEngine, {
|
||||
var credentials = this.getProperties('newPassword', 'ne2Password', 'token'),
|
||||
self = this;
|
||||
|
||||
this.toggleProperty('submitting');
|
||||
this.validate({format: false}).then(function () {
|
||||
this.validate().then(function () {
|
||||
self.toggleProperty('submitting');
|
||||
ajax({
|
||||
url: self.get('ghostPaths.url').api('authentication', 'passwordreset'),
|
||||
type: 'PUT',
|
||||
@ -52,9 +52,6 @@ export default Ember.Controller.extend(ValidationEngine, {
|
||||
self.get('notifications').showAPIError(response);
|
||||
self.toggleProperty('submitting');
|
||||
});
|
||||
}).catch(function (error) {
|
||||
self.toggleProperty('submitting');
|
||||
self.get('notifications').showErrors(error);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -8,12 +8,9 @@ export default Ember.Controller.extend({
|
||||
var notifications = this.get('notifications');
|
||||
|
||||
return this.get('model').save().then(function (model) {
|
||||
notifications.closeNotifications();
|
||||
|
||||
return model;
|
||||
}).catch(function (errors) {
|
||||
notifications.closeNotifications();
|
||||
notifications.showErrors(errors);
|
||||
}).catch(function (error) {
|
||||
notifications.showAPIError(error);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user