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 Moved Milestone emails to GA

- Moves Milestone emails from public beta to GA
This commit is contained in:
Aileen Nowak 2023-03-21 15:29:04 +00:00 committed by Aileen Booker
parent 846a9cdafc
commit 37383fde90
12 changed files with 16 additions and 61 deletions

View File

@ -68,7 +68,6 @@ export default class FeatureService extends Service {
@feature('webmentions') webmentions; @feature('webmentions') webmentions;
@feature('webmentionEmails') webmentionEmails; @feature('webmentionEmails') webmentionEmails;
@feature('emailErrors') emailErrors; @feature('emailErrors') emailErrors;
@feature('milestoneEmails') milestoneEmails;
@feature('websockets') websockets; @feature('websockets') websockets;
@feature('stripeAutomaticTax') stripeAutomaticTax; @feature('stripeAutomaticTax') stripeAutomaticTax;
@feature('makingItRain') makingItRain; @feature('makingItRain') makingItRain;

View File

@ -153,19 +153,6 @@
</div> </div>
</GhUploader> </GhUploader>
</div> </div>
<div class="gh-expandable-block">
<div class="gh-expandable-header">
<div>
<h4 class="gh-expandable-title">Milestones</h4>
<p class="gh-expandable-description">
Occasional summaries of your audience & revenue growth
</p>
</div>
<div class="for-switch">
<GhFeatureFlag @flag="milestoneEmails" />
</div>
</div>
</div>
</div> </div>
</div> </div>

View File

@ -346,7 +346,6 @@
</div> </div>
</div> </div>
{{/if}} {{/if}}
{{#if (feature 'milestoneEmails') }}
<div class="user-setting-toggle"> <div class="user-setting-toggle">
<div> <div>
<label for="user-email">Milestones</label> <label for="user-email">Milestones</label>
@ -368,7 +367,6 @@
</div> </div>
{{/if}} {{/if}}
{{/if}} {{/if}}
{{/if}}
</GhFormGroup> </GhFormGroup>
</div> </div>
{{/if}} {{/if}}

View File

@ -82,7 +82,6 @@ describe('Acceptance: Staff', function () {
enableStripe(this.server); enableStripe(this.server);
enableLabsFlag(this.server, 'webmentions'); enableLabsFlag(this.server, 'webmentions');
enableLabsFlag(this.server, 'webmentionEmails'); enableLabsFlag(this.server, 'webmentionEmails');
enableLabsFlag(this.server, 'milestoneEmails');
admin = this.server.create('user', {email: 'admin@example.com', roles: [adminRole]}); admin = this.server.create('user', {email: 'admin@example.com', roles: [adminRole]});

View File

@ -60,22 +60,18 @@ module.exports = {
* @returns {Promise<object>} * @returns {Promise<object>}
*/ */
async run() { async run() {
const labs = require('../../../shared/labs'); const members = await this.api.checkMilestones('members');
let arr;
const stripeLiveEnabled = getStripeLiveEnabled();
if (labs.isSet('milestoneEmails')) { if (stripeLiveEnabled) {
const members = await this.api.checkMilestones('members'); arr = await this.api.checkMilestones('arr');
let arr;
const stripeLiveEnabled = getStripeLiveEnabled();
if (stripeLiveEnabled) {
arr = await this.api.checkMilestones('arr');
}
return {
members,
arr
};
} }
return {
members,
arr
};
}, },
/** /**

View File

@ -1,6 +1,5 @@
const DomainEvents = require('@tryghost/domain-events'); const DomainEvents = require('@tryghost/domain-events');
const config = require('../../../shared/config'); const config = require('../../../shared/config');
const labs = require('../../../shared/labs');
const logging = require('@tryghost/logging'); const logging = require('@tryghost/logging');
class SlackNotificationsServiceWrapper { class SlackNotificationsServiceWrapper {
@ -48,7 +47,7 @@ class SlackNotificationsServiceWrapper {
const hostSettings = config.get('hostSettings'); const hostSettings = config.get('hostSettings');
const urlUtils = require('../../../shared/url-utils'); const urlUtils = require('../../../shared/url-utils');
const siteUrl = urlUtils.getSiteUrl(); 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; const webhookUrl = hostSettings?.milestones?.url;
this.#api = SlackNotificationsServiceWrapper.create({siteUrl, isEnabled, webhookUrl}); this.#api = SlackNotificationsServiceWrapper.create({siteUrl, isEnabled, webhookUrl});

View File

@ -28,8 +28,7 @@ const GA_FEATURES = [
// input for the "labs" setting value // input for the "labs" setting value
const BETA_FEATURES = [ const BETA_FEATURES = [
'activitypub', 'activitypub',
'webmentions', 'webmentions'
'milestoneEmails'
]; ];
const ALPHA_FEATURES = [ const ALPHA_FEATURES = [

View File

@ -166,7 +166,6 @@ describe('Milestones Service', function () {
}); });
sinon.createSandbox(); sinon.createSandbox();
configUtils.set('milestones', milestonesConfig); configUtils.set('milestones', milestonesConfig);
mockManager.mockLabsEnabled('milestoneEmails');
mockManager.mockMail(); mockManager.mockMail();
}); });
@ -298,15 +297,4 @@ describe('Milestones Service', function () {
assert(loggingStub.called); 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);
});
}); });

View File

@ -1,4 +1,4 @@
const {mockManager, configUtils} = require('../../../../utils/e2e-framework'); const {configUtils} = require('../../../../utils/e2e-framework');
const assert = require('assert'); const assert = require('assert');
const nock = require('nock'); const nock = require('nock');
const DomainEvents = require('@tryghost/domain-events'); const DomainEvents = require('@tryghost/domain-events');
@ -11,8 +11,6 @@ describe('Slack Notifications Service', function () {
beforeEach(function () { beforeEach(function () {
configUtils.set('hostSettings', {milestones: {enabled: true, url: 'https://testhooks.slack.com/'}}); configUtils.set('hostSettings', {milestones: {enabled: true, url: 'https://testhooks.slack.com/'}});
mockManager.mockLabsEnabled('milestoneEmails');
scope = nock('https://testhooks.slack.com/') scope = nock('https://testhooks.slack.com/')
.post('/') .post('/')
.reply(200, {ok: true}); .reply(200, {ok: true});
@ -21,7 +19,6 @@ describe('Slack Notifications Service', function () {
afterEach(async function () { afterEach(async function () {
nock.cleanAll(); nock.cleanAll();
await configUtils.restore(); await configUtils.restore();
mockManager.restore();
}); });
it('Can send a milestone created event', async function () { it('Can send a milestone created event', async function () {

View File

@ -17,7 +17,6 @@ describe('Staff Service:', function () {
mockManager.mockMail(); mockManager.mockMail();
mockManager.mockSlack(); mockManager.mockSlack();
mockManager.mockSetting('title', 'The Weekly Roundup'); mockManager.mockSetting('title', 'The Weekly Roundup');
mockManager.mockLabsEnabled('milestoneEmails');
sinon.stub(models.User, 'getEmailAlertUsers').resolves([{ sinon.stub(models.User, 'getEmailAlertUsers').resolves([{
email: 'owner@ghost.org', email: 'owner@ghost.org',

View File

@ -78,7 +78,7 @@ class StaffService {
/** @private */ /** @private */
async handleEvent(type, event) { 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); await this.emails.notifyMilestoneReceived(event.data);
} }

View File

@ -121,10 +121,7 @@ describe('StaffService', function () {
}; };
let stubs; let stubs;
let labs = { let labs = {
isSet: (flag) => { isSet: () => {
if (flag === 'milestoneEmails') {
return true;
}
return false; return false;
} }
}; };
@ -341,10 +338,7 @@ describe('StaffService', function () {
urlUtils, urlUtils,
settingsHelpers, settingsHelpers,
labs: { labs: {
isSet: (flag) => { isSet: () => {
if (flag === 'milestoneEmails') {
return true;
}
return false; return false;
} }
} }