2
1
Fork 0
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:
Nazar Gargol 2019-09-30 17:44:35 +02:00
parent 36379b2806
commit 84b08e627d
4 changed files with 0 additions and 56 deletions

View file

@ -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);
}

View file

@ -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;

View file

@ -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);
}

View file

@ -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;