0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-02-10 23:36:14 -05:00

Removed ghost_auth_id from Admin API v2 response

refs #10438

- unused field
- no need to expose this field
This commit is contained in:
kirrg001 2019-02-12 23:36:42 +01:00
parent db148e653f
commit 36547a9c3a
4 changed files with 41 additions and 38 deletions

View file

@ -27,43 +27,46 @@ const tag = (attrs, frame) => {
return attrs;
};
const author = (attrs) => {
// Already deleted in model.toJSON, but leaving here so that we can clean that up when we deprecate v0.1
delete attrs.created_at;
delete attrs.updated_at;
delete attrs.last_seen;
delete attrs.status;
const author = (attrs, frame) => {
if (localUtils.isContentAPI(frame)) {
// Already deleted in model.toJSON, but leaving here so that we can clean that up when we deprecate v0.1
delete attrs.created_at;
delete attrs.updated_at;
delete attrs.last_seen;
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 === '') {
attrs.twitter = null;
}
if (attrs.bio === '') {
attrs.bio = null;
}
if (attrs.website === '') {
attrs.website = null;
}
if (attrs.facebook === '') {
attrs.facebook = null;
}
if (attrs.meta_title === '') {
attrs.meta_title = null;
}
if (attrs.meta_description === '') {
attrs.meta_description = null;
}
if (attrs.location === '') {
attrs.location = null;
}
}
delete attrs.ghost_auth_id;
// 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 === '') {
attrs.twitter = null;
}
if (attrs.bio === '') {
attrs.bio = null;
}
if (attrs.website === '') {
attrs.website = null;
}
if (attrs.facebook === '') {
attrs.facebook = null;
}
if (attrs.meta_title === '') {
attrs.meta_title = null;
}
if (attrs.meta_description === '') {
attrs.meta_description = null;
}
if (attrs.location === '') {
attrs.location = null;
}
return attrs;
};

View file

@ -10,9 +10,7 @@ const mapUser = (model, frame) => {
url.forUser(model.id, jsonModel);
if (utils.isContentAPI(frame)) {
clean.author(jsonModel);
}
clean.author(jsonModel, frame);
return jsonModel;
};

View file

@ -32,6 +32,7 @@ const expectedProperties = {
.keys()
.without('password')
.without('ghost_auth_access_token')
.without('ghost_auth_id')
,
tag: _(schema.tags)
.keys()

View file

@ -29,6 +29,7 @@ const expectedProperties = {
.keys()
.without('password')
.without('ghost_auth_access_token')
.without('ghost_auth_id')
,
tag: _(schema.tags)
.keys()