From 37383fde90a8ce26ca020253bb153a24c30cf5a1 Mon Sep 17 00:00:00 2001 From: Aileen Nowak Date: Tue, 21 Mar 2023 15:29:04 +0000 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20Moved=20Milestone=20emails=20to=20G?= =?UTF-8?q?A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Moves Milestone emails from public beta to GA✨ Moved Milestone emails to GA - Moves Milestone emails from public beta to GA✨ Moved Milestone emails to GA - Moves Milestone emails from public beta to GA✨ Moved Milestone emails to GA - Moves Milestone emails from public beta to GA✨ Moved Milestone emails to GA - Moves Milestone emails from public beta to GA✨ Moved Milestone emails to GA - Moves Milestone emails from public beta to GA✨ Moved Milestone emails to GA - Moves Milestone emails from public beta to GA✨ Moved Milestone emails to GA - Moves Milestone emails from public beta to GA✨ Moved Milestone emails to GA - Moves Milestone emails from public beta to GA --- ghost/admin/app/services/feature.js | 1 - ghost/admin/app/templates/settings/labs.hbs | 13 ---------- .../app/templates/settings/staff/user.hbs | 2 -- ghost/admin/tests/acceptance/staff-test.js | 1 - .../server/services/milestones/service.js | 24 ++++++++----------- .../services/slack-notifications/service.js | 3 +-- ghost/core/core/shared/labs.js | 3 +-- .../e2e-server/services/milestones.test.js | 12 ---------- .../slack-notifications/index.test.js | 5 +--- .../unit/server/services/staff/index.test.js | 1 - ghost/staff-service/lib/staff-service.js | 2 +- .../staff-service/test/staff-service.test.js | 10 ++------ 12 files changed, 16 insertions(+), 61 deletions(-) diff --git a/ghost/admin/app/services/feature.js b/ghost/admin/app/services/feature.js index 007d20b2b3..3effd3e5be 100644 --- a/ghost/admin/app/services/feature.js +++ b/ghost/admin/app/services/feature.js @@ -68,7 +68,6 @@ export default class FeatureService extends Service { @feature('webmentions') webmentions; @feature('webmentionEmails') webmentionEmails; @feature('emailErrors') emailErrors; - @feature('milestoneEmails') milestoneEmails; @feature('websockets') websockets; @feature('stripeAutomaticTax') stripeAutomaticTax; @feature('makingItRain') makingItRain; diff --git a/ghost/admin/app/templates/settings/labs.hbs b/ghost/admin/app/templates/settings/labs.hbs index 87bb253693..d2ed309df8 100644 --- a/ghost/admin/app/templates/settings/labs.hbs +++ b/ghost/admin/app/templates/settings/labs.hbs @@ -153,19 +153,6 @@ -
-
-
-

Milestones

-

- Occasional summaries of your audience & revenue growth -

-
-
- -
-
-
diff --git a/ghost/admin/app/templates/settings/staff/user.hbs b/ghost/admin/app/templates/settings/staff/user.hbs index 98b69b6e0f..0abee8e646 100644 --- a/ghost/admin/app/templates/settings/staff/user.hbs +++ b/ghost/admin/app/templates/settings/staff/user.hbs @@ -346,7 +346,6 @@ {{/if}} - {{#if (feature 'milestoneEmails') }}
@@ -368,7 +367,6 @@
{{/if}} {{/if}} - {{/if}}
{{/if}} diff --git a/ghost/admin/tests/acceptance/staff-test.js b/ghost/admin/tests/acceptance/staff-test.js index f6d3667946..2d405bf8b0 100644 --- a/ghost/admin/tests/acceptance/staff-test.js +++ b/ghost/admin/tests/acceptance/staff-test.js @@ -82,7 +82,6 @@ describe('Acceptance: Staff', function () { enableStripe(this.server); enableLabsFlag(this.server, 'webmentions'); enableLabsFlag(this.server, 'webmentionEmails'); - enableLabsFlag(this.server, 'milestoneEmails'); admin = this.server.create('user', {email: 'admin@example.com', roles: [adminRole]}); diff --git a/ghost/core/core/server/services/milestones/service.js b/ghost/core/core/server/services/milestones/service.js index c1cfc176c1..820c7b40f2 100644 --- a/ghost/core/core/server/services/milestones/service.js +++ b/ghost/core/core/server/services/milestones/service.js @@ -60,22 +60,18 @@ module.exports = { * @returns {Promise} */ async run() { - const labs = require('../../../shared/labs'); + const members = await this.api.checkMilestones('members'); + let arr; + const stripeLiveEnabled = getStripeLiveEnabled(); - if (labs.isSet('milestoneEmails')) { - const members = await this.api.checkMilestones('members'); - let arr; - const stripeLiveEnabled = getStripeLiveEnabled(); - - if (stripeLiveEnabled) { - arr = await this.api.checkMilestones('arr'); - } - - return { - members, - arr - }; + if (stripeLiveEnabled) { + arr = await this.api.checkMilestones('arr'); } + + return { + members, + arr + }; }, /** diff --git a/ghost/core/core/server/services/slack-notifications/service.js b/ghost/core/core/server/services/slack-notifications/service.js index 411b2ea68d..85257e91e7 100644 --- a/ghost/core/core/server/services/slack-notifications/service.js +++ b/ghost/core/core/server/services/slack-notifications/service.js @@ -1,6 +1,5 @@ const DomainEvents = require('@tryghost/domain-events'); const config = require('../../../shared/config'); -const labs = require('../../../shared/labs'); const logging = require('@tryghost/logging'); class SlackNotificationsServiceWrapper { @@ -48,7 +47,7 @@ class SlackNotificationsServiceWrapper { const hostSettings = config.get('hostSettings'); const urlUtils = require('../../../shared/url-utils'); const siteUrl = urlUtils.getSiteUrl(); - const isEnabled = (labs.isSet('milestoneEmails') && hostSettings?.milestones?.enabled && hostSettings?.milestones?.url) ? true : false; + const isEnabled = !!(hostSettings?.milestones?.enabled && hostSettings?.milestones?.url); const webhookUrl = hostSettings?.milestones?.url; this.#api = SlackNotificationsServiceWrapper.create({siteUrl, isEnabled, webhookUrl}); diff --git a/ghost/core/core/shared/labs.js b/ghost/core/core/shared/labs.js index 702c260e95..b00837c9db 100644 --- a/ghost/core/core/shared/labs.js +++ b/ghost/core/core/shared/labs.js @@ -28,8 +28,7 @@ const GA_FEATURES = [ // input for the "labs" setting value const BETA_FEATURES = [ 'activitypub', - 'webmentions', - 'milestoneEmails' + 'webmentions' ]; const ALPHA_FEATURES = [ diff --git a/ghost/core/test/e2e-server/services/milestones.test.js b/ghost/core/test/e2e-server/services/milestones.test.js index 91a5ec39bd..fb90544110 100644 --- a/ghost/core/test/e2e-server/services/milestones.test.js +++ b/ghost/core/test/e2e-server/services/milestones.test.js @@ -166,7 +166,6 @@ describe('Milestones Service', function () { }); sinon.createSandbox(); configUtils.set('milestones', milestonesConfig); - mockManager.mockLabsEnabled('milestoneEmails'); mockManager.mockMail(); }); @@ -298,15 +297,4 @@ describe('Milestones Service', function () { assert(loggingStub.called); }); - - it('Does not run when milestoneEmails labs flag is not set', async function () { - mockManager.mockLabsDisabled('milestoneEmails'); - - const resultPromise = milestonesService.initAndRun(fifteenDays); - await clock.tickAsync(fifteenDays); - const result = await resultPromise; - assert(result === undefined); - - assert(loggingStub.called); - }); }); diff --git a/ghost/core/test/unit/server/services/slack-notifications/index.test.js b/ghost/core/test/unit/server/services/slack-notifications/index.test.js index 7fc745dc40..51a6d2d2c1 100644 --- a/ghost/core/test/unit/server/services/slack-notifications/index.test.js +++ b/ghost/core/test/unit/server/services/slack-notifications/index.test.js @@ -1,4 +1,4 @@ -const {mockManager, configUtils} = require('../../../../utils/e2e-framework'); +const {configUtils} = require('../../../../utils/e2e-framework'); const assert = require('assert'); const nock = require('nock'); const DomainEvents = require('@tryghost/domain-events'); @@ -11,8 +11,6 @@ describe('Slack Notifications Service', function () { beforeEach(function () { configUtils.set('hostSettings', {milestones: {enabled: true, url: 'https://testhooks.slack.com/'}}); - mockManager.mockLabsEnabled('milestoneEmails'); - scope = nock('https://testhooks.slack.com/') .post('/') .reply(200, {ok: true}); @@ -21,7 +19,6 @@ describe('Slack Notifications Service', function () { afterEach(async function () { nock.cleanAll(); await configUtils.restore(); - mockManager.restore(); }); it('Can send a milestone created event', async function () { diff --git a/ghost/core/test/unit/server/services/staff/index.test.js b/ghost/core/test/unit/server/services/staff/index.test.js index 2bfd5bc2a4..0159ec6e08 100644 --- a/ghost/core/test/unit/server/services/staff/index.test.js +++ b/ghost/core/test/unit/server/services/staff/index.test.js @@ -17,7 +17,6 @@ describe('Staff Service:', function () { mockManager.mockMail(); mockManager.mockSlack(); mockManager.mockSetting('title', 'The Weekly Roundup'); - mockManager.mockLabsEnabled('milestoneEmails'); sinon.stub(models.User, 'getEmailAlertUsers').resolves([{ email: 'owner@ghost.org', diff --git a/ghost/staff-service/lib/staff-service.js b/ghost/staff-service/lib/staff-service.js index 8614350585..8f06bd4005 100644 --- a/ghost/staff-service/lib/staff-service.js +++ b/ghost/staff-service/lib/staff-service.js @@ -78,7 +78,7 @@ class StaffService { /** @private */ async handleEvent(type, event) { - if (type === MilestoneCreatedEvent && event.data.milestone && this.labs.isSet('milestoneEmails')) { + if (type === MilestoneCreatedEvent && event.data.milestone) { await this.emails.notifyMilestoneReceived(event.data); } diff --git a/ghost/staff-service/test/staff-service.test.js b/ghost/staff-service/test/staff-service.test.js index 2ab22edb83..c4c7f674ff 100644 --- a/ghost/staff-service/test/staff-service.test.js +++ b/ghost/staff-service/test/staff-service.test.js @@ -121,10 +121,7 @@ describe('StaffService', function () { }; let stubs; let labs = { - isSet: (flag) => { - if (flag === 'milestoneEmails') { - return true; - } + isSet: () => { return false; } }; @@ -341,10 +338,7 @@ describe('StaffService', function () { urlUtils, settingsHelpers, labs: { - isSet: (flag) => { - if (flag === 'milestoneEmails') { - return true; - } + isSet: () => { return false; } }