Skip to content

Commit

Permalink
Removed more unused fields from Admin API v2 response
Browse files Browse the repository at this point in the history
refs #10438

- these fields are not used
- no need to expose them in v2
- we will either remove them in the next major or use them for new features (will see)
  • Loading branch information
kirrg001 committed Feb 13, 2019
1 parent a3e7a7b commit f8b62a0
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 7 deletions.
14 changes: 7 additions & 7 deletions core/server/api/v2/utils/serializers/output/utils/clean.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const tag = (attrs, frame) => {
// 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
// @NOTE: unused fields
delete attrs.parent;

return attrs;
Expand All @@ -36,10 +36,7 @@ const author = (attrs, frame) => {
delete attrs.status;

// Extra properties removed from v2
delete attrs.accessibility;
delete attrs.locale;
delete attrs.tour;
delete attrs.visibility;

// We are standardising on returning null from the Content API for any empty values
if (attrs.twitter === '') {
Expand All @@ -65,19 +62,20 @@ const author = (attrs, frame) => {
}
}

// @NOTE: unused fields
delete attrs.visibility;
delete attrs.accessibility;
delete attrs.locale;
delete attrs.ghost_auth_id;

return attrs;
};

const post = (attrs, frame) => {
if (localUtils.isContentAPI(frame)) {
delete attrs.locale;

// @TODO: https://github.com/TryGhost/Ghost/issues/10335
// delete attrs.page;
delete attrs.status;
delete attrs.visibility;

// We are standardising on returning null from the Content API for any empty values
if (attrs.twitter_title === '') {
Expand All @@ -100,6 +98,8 @@ const post = (attrs, frame) => {
}
}

delete attrs.locale;
delete attrs.visibility;
delete attrs.author;

return attrs;
Expand Down
5 changes: 5 additions & 0 deletions core/test/acceptance/old/admin/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,17 @@ const expectedProperties = {
.keys()
// by default we only return html
.without('mobiledoc', 'plaintext')
.without('visibility')
.without('locale')
// always returns computed properties: url, comment_id, primary_tag, primary_author
.without('author_id').concat('url', 'primary_tag', 'primary_author')
,
user: _(schema.users)
.keys()
.without('visibility')
.without('password')
.without('accessibility')
.without('locale')
.without('ghost_auth_access_token')
.without('ghost_auth_id')
,
Expand Down
5 changes: 5 additions & 0 deletions core/test/regression/api/v2/admin/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,17 @@ const expectedProperties = {
.keys()
// by default we only return html
.without('mobiledoc', 'plaintext')
.without('visibility')
.without('locale')
// always returns computed properties: url, comment_id, primary_tag, primary_author
.without('author_id').concat('url', 'primary_tag', 'primary_author')
,
user: _(schema.users)
.keys()
.without('visibility')
.without('password')
.without('accessibility')
.without('locale')
.without('ghost_auth_access_token')
.without('ghost_auth_id')
,
Expand Down

0 comments on commit f8b62a0

Please sign in to comment.