Removed posts.tags.parent sanitation

refs #10438

- As we strip parent and parent_id fields in /tags endpoint, similarly stripping it for posts related tags
This commit is contained in:
Nazar Gargol 2019-02-14 20:31:22 +00:00
parent c58e03a359
commit 921f9d394f
2 changed files with 9 additions and 19 deletions

View File

@ -108,25 +108,6 @@ module.exports = {
delete frame.data.posts[0].author;
}
/**
* Model notation is: `tag.parent_id`.
* The API notation is `tag.parent`.
*/
if (frame.data.posts[0].hasOwnProperty('tags')) {
if (_.isArray(frame.data.posts[0].tags) && frame.data.posts[0].tags.length) {
_.each(frame.data.posts[0].tags, (tag, index) => {
if (tag.hasOwnProperty('parent')) {
frame.data.posts[0].tags[index].parent_id = tag.parent;
delete frame.data.posts[0].tags[index].parent;
}
if (tag.hasOwnProperty('posts')) {
delete frame.data.posts[0].tags[index].posts;
}
});
}
}
frame.data.posts[0] = url.forPost(Object.assign({}, frame.data.posts[0]), frame.options);
},

View File

@ -174,6 +174,15 @@
"slug": {
"type": ["string", "null"],
"maxLength": 191
},
"parent": {
"strip": true
},
"parent_id": {
"strip": true
},
"posts": {
"strip": true
}
},
"anyOf": [