Reverted parent_id removal in tags in toJSON

no issue

- Partial rever of changes from https://github.com/TryGhost/Ghost/pull/11107/files#diff-792e00d413994563a1607b2be123da13L67-L68
- This code has effects how updated_at is behaving and broke "can\'t edit dates and authors of existing tag" test
- Based on bda76acba6 comment this removal should be moved into API layer but a more appropriate place then output serializer should be chosen (or original breaking test corrected)
This commit is contained in:
Nazar Gargol 2019-09-13 20:49:20 +02:00
parent caa121cae5
commit af93e95fdd

View File

@ -63,6 +63,10 @@ Tag = ghostBookshelf.Model.extend({
var options = Tag.filterOptions(unfilteredOptions, 'toJSON'),
attrs = ghostBookshelf.Model.prototype.toJSON.call(this, options);
// @NOTE: this serialization should be moved into api layer, it's not being moved as it's not used
attrs.parent = attrs.parent || attrs.parent_id;
delete attrs.parent_id;
return attrs;
},