Fixed sticky validation errors when editing webhooks

refs https://github.com/TryGhost/Ghost/issues/10137
- when closing the edit webhook modal we were rolling back the changed attributes of the webhook model but not clearing the errors object which meant a validation error was shown when re-opening the edit webhook modal
- add `reset()` method to the webhook edit controller and call that when leaving the edit route instead of only rolling back the changed attributes
This commit is contained in:
Kevin Ansfield 2018-11-13 11:40:24 +00:00
parent ac45494e69
commit f884eb891d
2 changed files with 6 additions and 1 deletions

View File

@ -15,5 +15,10 @@ export default Controller.extend({
this.transitionToRoute('settings.integration', integration);
});
}
},
reset() {
this.webhook.rollbackAttributes();
this.webhook.errors.clear();
}
});

View File

@ -9,6 +9,6 @@ export default Route.extend({
deactivate() {
this._super(...arguments);
this.controller.webhook.rollbackAttributes();
this.controller.reset();
}
});