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('webmentionEmails') webmentionEmails;
@feature('emailErrors') emailErrors;
@feature('milestoneEmails') milestoneEmails;
@feature('websockets') websockets;
@feature('stripeAutomaticTax') stripeAutomaticTax;
@feature('makingItRain') makingItRain;

View File

@ -153,19 +153,6 @@
</div>
</GhUploader>
</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>

View File

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

View File

@ -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]});

View File

@ -60,22 +60,18 @@ module.exports = {
* @returns {Promise<object>}
*/
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
};
},
/**

View File

@ -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});

View File

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

View File

@ -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);
});
});

View File

@ -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 () {

View File

@ -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',

View File

@ -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);
}

View File

@ -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;
}
}