Ghost/core/server/data
kirrg001 00cf043e15 Fixed missing defaults in model layer
no issue

- reported in the forum: https://forum.ghost.org/t/publishing-with-a-single-post-request-to-posts/1648
- the defaults are defined in two places
  1. on the schema level (defaults for the database)
  2. on the ORM (model layer)
- the defaults on the db layer are set correctly when inserting a new resource
- but if we don't apply all defaults on the model layer, it will happen that model events are emitted without the correct defaults
  - see comment in code base
  - it's caused by the fact that knex only returns the inserted resource id (probably caused by the fact knex has to support x databases)
- components/modules are listening on model events and expect:
  1. a complete set of attributes
  2. a complete set of defaults
  3. sanitized values e.g. bool, date
- this commit fixes:
  1. added missing defaults for user & post model
  2. sanitize booleans (0|1 => false|true)
  3. added tests to ensure this works as expected
  4. clarfies the usage of `defaults`

Regarding https://forum.ghost.org/t/publishing-with-a-single-post-request-to-posts/1648:
  - the post event was emitted with the following values {page: undefined, featured: undefined}
  - the urlservice receives this event and won't match the resource against collection filters correctly
  - NOTE: the post data in the db were correct
2018-06-26 16:35:23 +02: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 🐛 Fixed unable to publish a post after slack hook import 2018-06-11 11:08:08 +02:00
meta Dynamic Routing Beta: collection name behaviour 2018-06-21 20:59:43 +02:00
migrations 🔥 Drop Node v4 Support 2018-05-01 14:06:18 +02:00
schema Changed theme fixture post: point to forum instead of slack (#9703) 2018-06-25 22:06:21 +02:00
validation Fixed missing defaults in model layer 2018-06-26 16:35:23 +02:00
xml/sitemap Dynamic Routing Beta (#9596) 2018-06-05 19:02:20 +02:00
timezones.json Adds UTC as select option to timezones select list 2016-06-10 15:19:16 +02:00