mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-28 05:37:34 +03:00
Removed tag.parent
from Admin API v2 response
refs #10438 - this is an unused field - no need to expose this field - if we start working on nested tags, this field might become interesting/used
This commit is contained in:
parent
20300cf002
commit
db148e653f
@ -1,25 +1,28 @@
|
||||
const _ = require('lodash');
|
||||
const localUtils = require('../../../index');
|
||||
|
||||
const tag = (attrs) => {
|
||||
const tag = (attrs, frame) => {
|
||||
if (localUtils.isContentAPI(frame)) {
|
||||
delete attrs.created_at;
|
||||
delete attrs.updated_at;
|
||||
|
||||
// We are standardising on returning null from the Content API for any empty values
|
||||
if (attrs.meta_title === '') {
|
||||
attrs.meta_title = null;
|
||||
}
|
||||
if (attrs.meta_description === '') {
|
||||
attrs.meta_description = null;
|
||||
}
|
||||
if (attrs.description === '') {
|
||||
attrs.description = null;
|
||||
}
|
||||
}
|
||||
|
||||
// Already deleted in model.toJSON, but leaving here so that we can clean that up when we deprecate v0.1
|
||||
delete attrs.parent_id;
|
||||
|
||||
// Extra properties removed from v2
|
||||
delete attrs.parent;
|
||||
delete attrs.created_at;
|
||||
delete attrs.updated_at;
|
||||
|
||||
// We are standardising on returning null from the Content API for any empty values
|
||||
if (attrs.meta_title === '') {
|
||||
attrs.meta_title = null;
|
||||
}
|
||||
if (attrs.meta_description === '') {
|
||||
attrs.meta_description = null;
|
||||
}
|
||||
if (attrs.description === '') {
|
||||
attrs.description = null;
|
||||
}
|
||||
|
||||
return attrs;
|
||||
};
|
||||
|
@ -21,10 +21,7 @@ const mapTag = (model, frame) => {
|
||||
const jsonModel = model.toJSON ? model.toJSON(frame.options) : model;
|
||||
|
||||
url.forTag(model.id, jsonModel);
|
||||
|
||||
if (utils.isContentAPI(frame)) {
|
||||
clean.tag(jsonModel);
|
||||
}
|
||||
clean.tag(jsonModel, frame);
|
||||
|
||||
return jsonModel;
|
||||
};
|
||||
|
@ -35,8 +35,8 @@ const expectedProperties = {
|
||||
,
|
||||
tag: _(schema.tags)
|
||||
.keys()
|
||||
// Tag API swaps parent_id to parent
|
||||
.without('parent_id').concat('parent')
|
||||
// unused field
|
||||
.without('parent_id')
|
||||
,
|
||||
setting: _(schema.settings)
|
||||
.keys()
|
||||
|
@ -32,8 +32,8 @@ const expectedProperties = {
|
||||
,
|
||||
tag: _(schema.tags)
|
||||
.keys()
|
||||
// Tag API swaps parent_id to parent
|
||||
.without('parent_id').concat('parent')
|
||||
// unused field
|
||||
.without('parent_id')
|
||||
,
|
||||
setting: _(schema.settings)
|
||||
.keys()
|
||||
|
Loading…
Reference in New Issue
Block a user