Allowed optionally enabling collections through a flag

refs https://github.com/TryGhost/Ghost/pull/18028

- The previous conditional meant that if the "host settings" collections enabled flag was set, we couldn't disable collections. The referenced pull request would also disable the collections across all of the hosted environment instances. The updated logic optionally takes into account the "labs" flag, as it should have from the very beginning.
This commit is contained in:
Naz 2023-09-11 11:24:29 +08:00 committed by naz
parent bbb5b64ec5
commit ce10d34e5e

View File

@ -33,16 +33,16 @@ 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;
// host setting OR labs "collections" flag has to be enabled to run collections service
if (config.get('hostSettings:collections:enabled') || labs.isSet('collections')) {
if (inited) {
return;
}
inited = true;
this.api.subscribeToEvents();
}
inited = true;
this.api.subscribeToEvents();
}
}