From b54191dbe4a8b2a4078f3c9b80c9012861baed08 Mon Sep 17 00:00:00 2001 From: Naz Date: Wed, 30 Aug 2023 14:42:11 +0800 Subject: [PATCH] Added killswitch for collection sync functionality refs https://github.com/TryGhost/Arch/issues/80 refs https://github.com/TryGhost/Ghost/commit/3960bfac1db578fb0f359e761d3a9ef19d2c1b49 - The killswitch (a setting in host settings) is needed to control the feature on a hosted environment, so we can safely turn it off if it causes any major issues. --- ghost/core/core/server/services/collections/service.js | 7 +++++++ ghost/core/test/e2e-api/admin/posts-bulk.test.js | 1 + 2 files changed, 8 insertions(+) diff --git a/ghost/core/core/server/services/collections/service.js b/ghost/core/core/server/services/collections/service.js index db50168f3a..b7b455f564 100644 --- a/ghost/core/core/server/services/collections/service.js +++ b/ghost/core/core/server/services/collections/service.js @@ -31,6 +31,13 @@ class CollectionsServiceWrapper { } async init() { + const config = require('../../../shared/config'); + const labs = require('../../../shared/labs'); + // host setting OR labs "collections" flag has to be enabled to run collections service + if (!config.get('hostSettings:collections:enabled') && !(labs.isSet('collections'))) { + return; + } + if (inited) { return; } diff --git a/ghost/core/test/e2e-api/admin/posts-bulk.test.js b/ghost/core/test/e2e-api/admin/posts-bulk.test.js index 093b691f72..1318d72884 100644 --- a/ghost/core/test/e2e-api/admin/posts-bulk.test.js +++ b/ghost/core/test/e2e-api/admin/posts-bulk.test.js @@ -8,6 +8,7 @@ describe('Posts Bulk API', function () { before(async function () { mockManager.mockLabsEnabled('collections'); + agent = await agentProvider.getAdminAPIAgent(); // Note that we generate lots of fixtures here to test the bulk deletion correctly