mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-03-11 02:12:21 -05:00
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:
parent
c58e03a359
commit
921f9d394f
2 changed files with 9 additions and 19 deletions
|
@ -108,25 +108,6 @@ module.exports = {
|
||||||
delete frame.data.posts[0].author;
|
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);
|
frame.data.posts[0] = url.forPost(Object.assign({}, frame.data.posts[0]), frame.options);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -174,6 +174,15 @@
|
||||||
"slug": {
|
"slug": {
|
||||||
"type": ["string", "null"],
|
"type": ["string", "null"],
|
||||||
"maxLength": 191
|
"maxLength": 191
|
||||||
|
},
|
||||||
|
"parent": {
|
||||||
|
"strip": true
|
||||||
|
},
|
||||||
|
"parent_id": {
|
||||||
|
"strip": true
|
||||||
|
},
|
||||||
|
"posts": {
|
||||||
|
"strip": true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"anyOf": [
|
"anyOf": [
|
||||||
|
|
Loading…
Add table
Reference in a new issue