From b724b2be92d5d8e71ce09a21c00ceafcff04fec4 Mon Sep 17 00:00:00 2001 From: Thibaut Patel Date: Wed, 27 Jan 2021 14:50:09 +0100 Subject: [PATCH] Removed the deprecated `send_email_when_published` field from the API refs https://github.com/TryGhost/Team/issues/457 --- .../api/canary/utils/serializers/input/posts.js | 8 -------- .../utils/serializers/output/utils/mapper.js | 9 --------- test/api-acceptance/admin/utils.js | 1 - test/api-acceptance/content/posts_spec.js | 16 ---------------- test/api-acceptance/content/utils.js | 1 - test/regression/api/canary/admin/utils.js | 1 - test/regression/api/canary/content/utils.js | 1 - 7 files changed, 37 deletions(-) diff --git a/core/server/api/canary/utils/serializers/input/posts.js b/core/server/api/canary/utils/serializers/input/posts.js index 190bdb3b91..f2a760e8ec 100644 --- a/core/server/api/canary/utils/serializers/input/posts.js +++ b/core/server/api/canary/utils/serializers/input/posts.js @@ -108,10 +108,6 @@ module.exports = { forcePageFilter(frame); - if (frame.options.columns && frame.options.columns.includes('send_email_when_published')) { - frame.options.columns.push('email_recipient_filter'); - } - /** * ## current cases: * - context object is empty (functional call, content api access) @@ -140,10 +136,6 @@ module.exports = { forcePageFilter(frame); - if (frame.options.columns && frame.options.columns.includes('send_email_when_published')) { - frame.options.columns.push('email_recipient_filter'); - } - /** * ## current cases: * - context object is empty (functional call, content api access) diff --git a/core/server/api/canary/utils/serializers/output/utils/mapper.js b/core/server/api/canary/utils/serializers/output/utils/mapper.js index 778e8744e7..c46b5881aa 100644 --- a/core/server/api/canary/utils/serializers/output/utils/mapper.js +++ b/core/server/api/canary/utils/serializers/output/utils/mapper.js @@ -47,14 +47,6 @@ const mapPost = (model, frame) => { gating.forPost(jsonModel, frame); } - if (typeof jsonModel.email_recipient_filter === 'undefined') { - jsonModel.send_email_when_published = null; - } else if (jsonModel.email_recipient_filter === 'none') { - jsonModel.send_email_when_published = false; - } else { - jsonModel.send_email_when_published = true; - } - clean.post(jsonModel, frame); if (frame.options && frame.options.withRelated) { @@ -96,7 +88,6 @@ const mapPage = (model, frame) => { const jsonModel = mapPost(model, frame); delete jsonModel.email_subject; - delete jsonModel.send_email_when_published; delete jsonModel.email_recipient_filter; return jsonModel; diff --git a/test/api-acceptance/admin/utils.js b/test/api-acceptance/admin/utils.js index 4e16878caa..2c66d22369 100644 --- a/test/api-acceptance/admin/utils.js +++ b/test/api-acceptance/admin/utils.js @@ -44,7 +44,6 @@ const expectedProperties = { .concat( ..._(schema.posts_meta).keys().without('post_id', 'id') ) - .concat('send_email_when_published') , page: _(schema.posts) diff --git a/test/api-acceptance/content/posts_spec.js b/test/api-acceptance/content/posts_spec.js index e62c2d6f4f..bafe8849e6 100644 --- a/test/api-acceptance/content/posts_spec.js +++ b/test/api-acceptance/content/posts_spec.js @@ -174,22 +174,6 @@ describe('Posts Content API', function () { res.body.posts[0].url.should.eql('http://127.0.0.1:2369/welcome/'); }); - it('Can request send_email_when_published calculated field of posts', async function () { - const res = await request.get(localUtils.API.getApiQuery(`posts/?key=${validKey}&fields=url&fields=send_email_when_published`)) - .set('Origin', testUtils.API.getURL()) - .expect('Content-Type', /json/) - .expect('Cache-Control', testUtils.cacheRules.private) - .expect(200); - - const jsonResponse = res.body; - - should.exist(jsonResponse.posts); - - localUtils.API.checkResponse(jsonResponse.posts[0], 'post', false, false, ['url', 'send_email_when_published']); - res.body.posts[0].url.should.eql('http://127.0.0.1:2369/welcome/'); - res.body.posts[0].send_email_when_published.should.eql(false); - }); - it('Can include relations', async function () { const res = await request.get(localUtils.API.getApiQuery(`posts/?key=${validKey}&include=tags,authors`)) .set('Origin', testUtils.API.getURL()) diff --git a/test/api-acceptance/content/utils.js b/test/api-acceptance/content/utils.js index 1b13ba5ada..7e56248ecf 100644 --- a/test/api-acceptance/content/utils.js +++ b/test/api-acceptance/content/utils.js @@ -36,7 +36,6 @@ const expectedProperties = { ..._(schema.posts_meta).keys().without('post_id', 'id') ) .concat('reading_time') - .concat('send_email_when_published') , author: _(schema.users) .keys() diff --git a/test/regression/api/canary/admin/utils.js b/test/regression/api/canary/admin/utils.js index aae318a491..f52b7cf101 100644 --- a/test/regression/api/canary/admin/utils.js +++ b/test/regression/api/canary/admin/utils.js @@ -36,7 +36,6 @@ const expectedProperties = { .concat( ..._(schema.posts_meta).keys().without('post_id', 'id') ) - .concat('send_email_when_published') , user: _(schema.users) .keys() diff --git a/test/regression/api/canary/content/utils.js b/test/regression/api/canary/content/utils.js index a6c9a33774..4fac2a65ca 100644 --- a/test/regression/api/canary/content/utils.js +++ b/test/regression/api/canary/content/utils.js @@ -35,7 +35,6 @@ const expectedProperties = { ..._(schema.posts_meta).keys().without('post_id', 'id') ) .concat('reading_time') - .concat('send_email_when_published') , author: _(schema.users) .keys()