From d91d6c1311dccae1c850d13ab91bc4b631ba09f7 Mon Sep 17 00:00:00 2001 From: Simon Backx Date: Tue, 23 Aug 2022 16:26:34 +0200 Subject: [PATCH] Added attribution counts to Pages API (#15289) fixes https://github.com/TryGhost/Team/issues/1835 This was missed in the initial pass when adding to the Posts API --- ghost/core/core/server/api/endpoints/pages.js | 2 +- .../core/server/api/endpoints/utils/serializers/input/pages.js | 2 +- ghost/core/test/e2e-api/admin/pages.test.js | 2 ++ 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/ghost/core/core/server/api/endpoints/pages.js b/ghost/core/core/server/api/endpoints/pages.js index 5cbc05cb74..621992b26a 100644 --- a/ghost/core/core/server/api/endpoints/pages.js +++ b/ghost/core/core/server/api/endpoints/pages.js @@ -2,7 +2,7 @@ const models = require('../../models'); const tpl = require('@tryghost/tpl'); const errors = require('@tryghost/errors'); const getPostServiceInstance = require('../../services/posts/posts-service'); -const ALLOWED_INCLUDES = ['tags', 'authors', 'authors.roles', 'tiers']; +const ALLOWED_INCLUDES = ['tags', 'authors', 'authors.roles', 'tiers', 'count.signups', 'count.conversions']; const UNSAFE_ATTRS = ['status', 'authors', 'visibility']; const messages = { diff --git a/ghost/core/core/server/api/endpoints/utils/serializers/input/pages.js b/ghost/core/core/server/api/endpoints/utils/serializers/input/pages.js index c20dc53475..33e6173052 100644 --- a/ghost/core/core/server/api/endpoints/utils/serializers/input/pages.js +++ b/ghost/core/core/server/api/endpoints/utils/serializers/input/pages.js @@ -23,7 +23,7 @@ function defaultRelations(frame) { return false; } - frame.options.withRelated = ['tags', 'authors', 'authors.roles', 'tiers']; + frame.options.withRelated = ['tags', 'authors', 'authors.roles', 'tiers', 'count.signups', 'count.conversions']; } function setDefaultOrder(frame) { diff --git a/ghost/core/test/e2e-api/admin/pages.test.js b/ghost/core/test/e2e-api/admin/pages.test.js index bed3612292..f82ec32784 100644 --- a/ghost/core/test/e2e-api/admin/pages.test.js +++ b/ghost/core/test/e2e-api/admin/pages.test.js @@ -6,6 +6,7 @@ const testUtils = require('../../utils'); const config = require('../../../core/shared/config'); const models = require('../../../core/server/models'); const localUtils = require('./utils'); +const mockManager = require('../../utils/e2e-framework-mock-manager'); describe('Pages API', function () { let request; @@ -14,6 +15,7 @@ describe('Pages API', function () { await localUtils.startGhost(); request = supertest.agent(config.get('url')); await localUtils.doAuth(request, 'users:extra', 'posts'); + mockManager.mockLabsDisabled('memberAttribution'); }); it('Can retrieve all pages', async function () {