0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-01-06 22:40:14 -05:00
ghost/core/server/data
Katharina Irrgang 0aff9f33d9
Improved validation layer (#9427)
refs https://github.com/TryGhost/Ghost/issues/3658

- the `validateSchema` helper was a bit broken
  - if you add a user without email, you will receive a database error
  - but the validation error should catch that email is passed with null
- it was broken, because:
  - A: it called `toJSON` -> this can remove properties from the output (e.g. password)
  - B: we only validated fields, which were part of the JSON data (model.hasOwnProperty)
- we now differentiate between schema validation for update and insert
- fixed one broken import test
  - if you import a post without a status, it should not error
  - it falls back to the default value
- removed user model `onValidate`
  - the user model added a custom implementation of `onValidate`, because of a bug which we experienced (see https://github.com/TryGhost/Ghost/issues/3638)
  - with the refactoring this is no longer required - we only validate fields which have changed when updating resources
  - also, removed extra safe catch when logging in (no longer needed - unit tested)
- add lot's of unit tests to proof the code change
- always call the base class, except you have a good reason
2018-02-16 00:49:15 +01:00
..
db Backup endpoint improvements (#9365) 2018-01-11 16:03:21 +01:00
export Backup endpoint improvements (#9365) 2018-01-11 16:03:21 +01:00
importer Make use of ES6 arrow functions in our data importer 2018-01-28 15:48:24 +01:00
meta Moved social utility to lib/social 2017-12-14 22:34:05 +01:00
migrations Contributor Role (#9315) 2018-02-07 10:46:22 +01:00
schema 🐛 Fixed migrating from < 1.13 to 1.21 2018-02-07 12:31:21 +01:00
validation Improved validation layer (#9427) 2018-02-16 00:49:15 +01:00
xml/sitemap Import lib/common only 2017-12-12 10:28:13 +01:00
timezones.json Adds UTC as select option to timezones select list 2016-06-10 15:19:16 +02:00