Moved labs utlity to shared

- This isn't really a "service" - it's a set of utilities for working with labs flags
- It's also required all over the place, and doesn't require anything that isn't shared
- Therefore, it should live in shared
This commit is contained in:
Hannah Wolfe 2021-07-07 21:41:34 +01:00
parent 6fb8736560
commit 782de52678
No known key found for this signature in database
GPG Key ID: 9F8C7532D0A6BA55
26 changed files with 27 additions and 27 deletions

View File

@ -47,7 +47,7 @@ module.exports = {
},
// Labs utils for enabling/disabling helpers
labs: require('../../server/services/labs'),
labs: require('../../shared/labs'),
// Things required from data/meta
metaData: require('../meta'),

View File

@ -5,7 +5,7 @@ const {api} = require('../proxy');
const errors = require('@tryghost/errors');
const tpl = require('@tryghost/tpl');
const settingsCache = require('../../../shared/settings-cache');
const labs = require('../../../server/services/labs');
const labs = require('../../../shared/labs');
const activeTheme = require('./active');
const preview = require('./preview');

View File

@ -5,7 +5,7 @@ const moment = require('moment-timezone');
const errors = require('@tryghost/errors');
const models = require('../../models');
const membersService = require('../../services/members');
const labsService = require('../../services/labs');
const labsService = require('../../../shared/labs');
const settingsCache = require('../../../shared/settings-cache');
const i18n = require('../../../shared/i18n');

View File

@ -2,7 +2,7 @@ const _ = require('lodash');
const url = require('./utils/url');
const typeGroupMapper = require('../../../../shared/serializers/input/utils/settings-filter-type-group-mapper');
const settingsCache = require('../../../../../../shared/settings-cache');
const {WRITABLE_KEYS_ALLOWLIST} = require('../../../../../services/labs');
const {WRITABLE_KEYS_ALLOWLIST} = require('../../../../../../shared/labs');
const DEPRECATED_SETTINGS = [
'bulk_email_settings',

View File

@ -1,6 +1,6 @@
const _ = require('lodash');
const localUtils = require('../../../index');
const labsService = require('../../../../../../services/labs');
const labsService = require('../../../../../../../shared/labs');
const tag = (attrs, frame) => {
if (localUtils.isContentAPI(frame)) {

View File

@ -7,7 +7,7 @@ const models = require('../../../../models');
const defaultSettings = require('../../../schema').defaultSettings;
const keyGroupMapper = require('../../../../api/shared/serializers/input/utils/settings-key-group-mapper');
const keyTypeMapper = require('../../../../api/shared/serializers/input/utils/settings-key-type-mapper');
const {WRITABLE_KEYS_ALLOWLIST} = require('../../../../services/labs');
const {WRITABLE_KEYS_ALLOWLIST} = require('../../../../../shared/labs');
const labsDefaults = JSON.parse(defaultSettings.labs.labs.defaultValue);
const ignoredSettings = ['slack_url', 'members_from_address', 'members_support_address'];

View File

@ -9,7 +9,7 @@ const i18n = require('../../shared/i18n');
const errors = require('@tryghost/errors');
const validator = require('@tryghost/validator');
const urlUtils = require('../../shared/url-utils');
const {WRITABLE_KEYS_ALLOWLIST} = require('../services/labs');
const {WRITABLE_KEYS_ALLOWLIST} = require('../../shared/labs');
const internalContext = {context: {internal: true}};
let Settings;

View File

@ -17,7 +17,7 @@ const db = require('../../data/db');
const models = require('../../models');
const postEmailSerializer = require('./post-email-serializer');
const {getSegmentsFromHtml} = require('./segment-parser');
const labs = require('../labs');
const labs = require('../../../shared/labs');
// Used to listen to email.added and email.edited model events originally, I think to offload this - ideally would just use jobs now if possible
const events = require('../../lib/common/events');

View File

@ -7,7 +7,7 @@ const urlUtils = require('../../../../shared/url-utils');
const db = require('../../../data/db');
const emailTemplate = require('./email-template');
const jobsService = require('../../jobs');
const labsService = require('../../labs');
const labsService = require('../../../../shared/labs');
const ghostMailer = new GhostMailer();
module.exports = class MembersCSVImporter {

View File

@ -5,7 +5,7 @@ const urlUtils = require('../../../shared/url-utils');
const ghostVersion = require('@tryghost/version');
const settingsCache = require('../../../shared/settings-cache');
const {formattedMemberResponse} = require('./utils');
const labsService = require('../labs');
const labsService = require('../../../shared/labs');
const config = require('../../../shared/config');
// @TODO: This piece of middleware actually belongs to the frontend, not to the member app

View File

@ -1,6 +1,6 @@
const {isPlainObject} = require('lodash');
const config = require('../../../shared/config');
const labs = require('../labs');
const labs = require('../../../shared/labs');
const ghostVersion = require('@tryghost/version');
module.exports = function getConfigProperties() {

View File

@ -1,5 +1,5 @@
const errors = require('@tryghost/errors');
const labsUtil = require('../../../services/labs');
const labsUtil = require('../../../../shared/labs');
const labs = flag => (req, res, next) => {
if (labsUtil.isSet(flag) === true) {

View File

@ -5,8 +5,8 @@ const errors = require('@tryghost/errors');
const logging = require('@tryghost/logging');
const tpl = require('@tryghost/tpl');
const settingsCache = require('../../shared/settings-cache');
const config = require('../../shared/config');
const settingsCache = require('./settings-cache');
const config = require('./config');
const messages = {
errorMessage: 'The \\{\\{{helperName}\\}\\} helper is not available.',

View File

@ -5,7 +5,7 @@ const sinon = require('sinon');
const testUtils = require('../../utils');
const localUtils = require('./utils');
const config = require('../../../core/shared/config');
const labs = require('../../../core/server/services/labs');
const labs = require('../../../core/shared/labs');
const Papa = require('papaparse');
const moment = require('moment-timezone');

View File

@ -6,7 +6,7 @@ const sinon = require('sinon');
const testUtils = require('../../../../utils');
const localUtils = require('./utils');
const config = require('../../../../../core/shared/config');
const labs = require('../../../../../core/server/services/labs');
const labs = require('../../../../../core/shared/labs');
const mailService = require('../../../../../core/server/services/mail');
const ghost = testUtils.startGhost;

View File

@ -5,7 +5,7 @@ const sinon = require('sinon');
const testUtils = require('../../../../utils');
const localUtils = require('./utils');
const config = require('../../../../../core/shared/config');
const labs = require('../../../../../core/server/services/labs');
const labs = require('../../../../../core/shared/labs');
const ghost = testUtils.startGhost;

View File

@ -3,7 +3,7 @@ const sinon = require('sinon');
const moment = require('moment');
const supertest = require('supertest');
const _ = require('lodash');
const labs = require('../../../../../core/server/services/labs');
const labs = require('../../../../../core/shared/labs');
const testUtils = require('../../../../utils');
const localUtils = require('./utils');
const configUtils = require('../../../../utils/configUtils');

View File

@ -5,7 +5,7 @@ const moment = require('moment');
const supertest = require('supertest');
const _ = require('lodash');
const cheerio = require('cheerio');
const labs = require('../../../../../core/server/services/labs');
const labs = require('../../../../../core/shared/labs');
const testUtils = require('../../../../utils');
const localUtils = require('./utils');
const configUtils = require('../../../../utils/configUtils');

View File

@ -6,7 +6,7 @@ const sinon = require('sinon');
const testUtils = require('../../../../utils');
const localUtils = require('./utils');
const config = require('../../../../../core/shared/config');
const labs = require('../../../../../core/server/services/labs');
const labs = require('../../../../../core/shared/labs');
const mailService = require('../../../../../core/server/services/mail');
const ghost = testUtils.startGhost;

View File

@ -5,7 +5,7 @@ const sinon = require('sinon');
const testUtils = require('../../../../utils');
const localUtils = require('./utils');
const config = require('../../../../../core/shared/config');
const labs = require('../../../../../core/server/services/labs');
const labs = require('../../../../../core/shared/labs');
const ghost = testUtils.startGhost;

View File

@ -3,7 +3,7 @@ const sinon = require('sinon');
const moment = require('moment');
const supertest = require('supertest');
const _ = require('lodash');
const labs = require('../../../../../core/server/services/labs');
const labs = require('../../../../../core/shared/labs');
const testUtils = require('../../../../utils');
const localUtils = require('./utils');
const configUtils = require('../../../../utils/configUtils');

View File

@ -2,7 +2,7 @@ const should = require('should');
const sinon = require('sinon');
const hbs = require('../../../core/frontend/services/theme-engine/engine');
const helpers = require('../../../core/frontend/helpers');
const labs = require('../../../core/server/services/labs');
const labs = require('../../../core/shared/labs');
const configUtils = require('../../utils/configUtils');
describe('{{cancel_link}} helper', function () {

View File

@ -2,7 +2,7 @@ const should = require('should');
const sinon = require('sinon');
const _ = require('lodash');
const helpers = require('../../../core/frontend/helpers');
const labs = require('../../../core/server/services/labs');
const labs = require('../../../core/shared/labs');
const handlebars = require('../../../core/frontend/services/theme-engine/engine').handlebars;
describe('Match helper', function () {

View File

@ -2,7 +2,7 @@ const should = require('should');
const sinon = require('sinon');
const configUtils = require('../../utils/configUtils');
const labs = require('../../../core/server/services/labs');
const labs = require('../../../core/shared/labs');
const settingsCache = require('../../../core/shared/settings-cache');
describe('Labs Service', function () {

View File

@ -3,7 +3,7 @@ const sinon = require('sinon');
const _ = require('lodash');
const testUtils = require('../../../../utils');
const helpers = require('../../../../../core/frontend/services/routing/helpers');
const labs = require('../../../../../core/server/services/labs');
const labs = require('../../../../../core/shared/labs');
describe('Contexts', function () {
let req;

View File

@ -14,7 +14,7 @@ const fixtureUtils = require('../../core/server/data/schema/fixtures/utils');
const emailAnalyticsService = require('../../core/server/services/email-analytics');
const permissions = require('../../core/server/services/permissions');
const settingsService = require('../../core/server/services/settings');
const labsService = require('../../core/server/services/labs');
const labsService = require('../../core/shared/labs');
// Other Test Utilities
const context = require('./fixtures/context');