Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added notes about attribute serialization for tag parent and author author_id #9932

Merged
merged 1 commit into from
Oct 1, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions core/server/models/relations/authors.js
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ module.exports.extendModel = function extendModel(Post, Posts, ghostBookshelf) {
delete attrs.author_id;
} else {
// CASE: we return `post.author=id` with or without requested columns.
// @NOTE: this serialization should be moved into api layer, it's not being moved as it's not used
if (!options.columns || (options.columns && options.columns.indexOf('author') !== -1)) {
attrs.author = attrs.author_id;
delete attrs.author_id;
Expand Down
1 change: 1 addition & 0 deletions core/server/models/tag.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ 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;

Expand Down