mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-27 10:42:45 +03:00
786e0ac9c5
no issue - if a plain native class instance with tracked properties is validated against the `ValidationEngine` and it's associated validators would cause errors by assuming that the instance has a `.get()` method - updated all model access in `ValidationEngine` and the validators to use direct property access which works for both native class and `EmberObject` instances
19 lines
422 B
JavaScript
19 lines
422 B
JavaScript
import BaseValidator from './base';
|
|
import {isBlank} from '@ember/utils';
|
|
|
|
export default BaseValidator.create({
|
|
properties: ['name'],
|
|
|
|
name(model) {
|
|
let name = model.name;
|
|
let hasValidated = model.hasValidated;
|
|
|
|
if (isBlank(name)) {
|
|
model.errors.add('name', 'Please enter a benefit');
|
|
this.invalidate();
|
|
}
|
|
|
|
hasValidated.addObject('name');
|
|
}
|
|
});
|