Cleaned up onValidate method on settings model

no-issue

Explicit arguments and async/await make this nicer on the eyes
This commit is contained in:
Fabien O'Carroll 2020-06-30 16:39:37 +02:00 committed by Fabien 'egg' O'Carroll
parent dd270b399c
commit 774187ced5

View File

@ -122,13 +122,9 @@ Settings = ghostBookshelf.Model.extend({
model.emitChange(model.attributes.key + '.' + 'edited', options); model.emitChange(model.attributes.key + '.' + 'edited', options);
}, },
onValidate: function onValidate() { async onValidate(model, attr, options) {
const self = this; await ghostBookshelf.Model.prototype.onValidate.call(this, model, attr, options);
await validation.validateSettings(getDefaultSettings(), model);
return ghostBookshelf.Model.prototype.onValidate.apply(this, arguments)
.then(function then() {
return validation.validateSettings(getDefaultSettings(), self);
});
}, },
format() { format() {