mirror of
https://github.com/TryGhost/Ghost.git
synced 2023-12-13 21:00:40 +01:00
Removed #member tag logic from input/output serializers
This commit is contained in:
parent
36379b2806
commit
84b08e627d
4 changed files with 0 additions and 56 deletions
|
@ -2,7 +2,6 @@ const _ = require('lodash');
|
|||
const debug = require('ghost-ignition').debug('api:canary:utils:serializers:input:posts');
|
||||
const url = require('./utils/url');
|
||||
const localUtils = require('../../index');
|
||||
const labs = require('../../../../../services/labs');
|
||||
const converters = require('../../../../../lib/mobiledoc/converters');
|
||||
|
||||
function removeMobiledocFormat(frame) {
|
||||
|
@ -13,14 +12,6 @@ function removeMobiledocFormat(frame) {
|
|||
}
|
||||
}
|
||||
|
||||
function includeTags(frame) {
|
||||
if (!frame.options.withRelated) {
|
||||
frame.options.withRelated = ['tags'];
|
||||
} else if (!frame.options.withRelated.includes('tags')) {
|
||||
frame.options.withRelated.push('tags');
|
||||
}
|
||||
}
|
||||
|
||||
function defaultRelations(frame) {
|
||||
if (frame.options.withRelated) {
|
||||
return;
|
||||
|
@ -94,11 +85,6 @@ module.exports = {
|
|||
// CASE: the content api endpoint for posts should not return mobiledoc
|
||||
removeMobiledocFormat(frame);
|
||||
|
||||
// CASE: Members needs to have the tags to check if its allowed access
|
||||
if (labs.isSet('members')) {
|
||||
includeTags(frame);
|
||||
}
|
||||
|
||||
setDefaultOrder(frame);
|
||||
}
|
||||
|
||||
|
@ -126,11 +112,6 @@ module.exports = {
|
|||
// CASE: the content api endpoint for posts should not return mobiledoc
|
||||
removeMobiledocFormat(frame);
|
||||
|
||||
if (labs.isSet('members')) {
|
||||
// CASE: Members needs to have the tags to check if its allowed access
|
||||
includeTags(frame);
|
||||
}
|
||||
|
||||
setDefaultOrder(frame);
|
||||
}
|
||||
|
||||
|
|
|
@ -36,15 +36,6 @@ const forPost = (attrs, frame) => {
|
|||
attrs[field] = '';
|
||||
});
|
||||
}
|
||||
|
||||
// CASE: Members always adds tags, remove if the user didn't originally ask for them
|
||||
const origQueryOrOptions = frame.original.query || frame.original.options || {};
|
||||
const origInclude = origQueryOrOptions.include;
|
||||
|
||||
if (!origInclude || !origInclude.includes('tags')) {
|
||||
delete attrs.tags;
|
||||
attrs.primary_tag = null;
|
||||
}
|
||||
}
|
||||
|
||||
return attrs;
|
||||
|
|
|
@ -2,7 +2,6 @@ const _ = require('lodash');
|
|||
const debug = require('ghost-ignition').debug('api:v2:utils:serializers:input:posts');
|
||||
const url = require('./utils/url');
|
||||
const localUtils = require('../../index');
|
||||
const labs = require('../../../../../services/labs');
|
||||
const converters = require('../../../../../lib/mobiledoc/converters');
|
||||
|
||||
function removeMobiledocFormat(frame) {
|
||||
|
@ -13,14 +12,6 @@ function removeMobiledocFormat(frame) {
|
|||
}
|
||||
}
|
||||
|
||||
function includeTags(frame) {
|
||||
if (!frame.options.withRelated) {
|
||||
frame.options.withRelated = ['tags'];
|
||||
} else if (!frame.options.withRelated.includes('tags')) {
|
||||
frame.options.withRelated.push('tags');
|
||||
}
|
||||
}
|
||||
|
||||
function defaultRelations(frame) {
|
||||
if (frame.options.withRelated) {
|
||||
return;
|
||||
|
@ -94,11 +85,6 @@ module.exports = {
|
|||
// CASE: the content api endpoint for posts should not return mobiledoc
|
||||
removeMobiledocFormat(frame);
|
||||
|
||||
// CASE: Members needs to have the tags to check if its allowed access
|
||||
if (labs.isSet('members')) {
|
||||
includeTags(frame);
|
||||
}
|
||||
|
||||
setDefaultOrder(frame);
|
||||
}
|
||||
|
||||
|
@ -126,11 +112,6 @@ module.exports = {
|
|||
// CASE: the content api endpoint for posts should not return mobiledoc
|
||||
removeMobiledocFormat(frame);
|
||||
|
||||
if (labs.isSet('members')) {
|
||||
// CASE: Members needs to have the tags to check if its allowed access
|
||||
includeTags(frame);
|
||||
}
|
||||
|
||||
setDefaultOrder(frame);
|
||||
}
|
||||
|
||||
|
|
|
@ -36,15 +36,6 @@ const forPost = (attrs, frame) => {
|
|||
attrs[field] = '';
|
||||
});
|
||||
}
|
||||
|
||||
// CASE: Members always adds tags, remove if the user didn't originally ask for them
|
||||
const origQueryOrOptions = frame.original.query || frame.original.options || {};
|
||||
const origInclude = origQueryOrOptions.include;
|
||||
|
||||
if (!origInclude || !origInclude.includes('tags')) {
|
||||
delete attrs.tags;
|
||||
attrs.primary_tag = null;
|
||||
}
|
||||
}
|
||||
|
||||
return attrs;
|
||||
|
|
Loading…
Reference in a new issue