From 19249bdae5ec851189031fb29d05e6eb35a93723 Mon Sep 17 00:00:00 2001 From: Simon Backx Date: Thu, 5 May 2022 13:36:16 +0200 Subject: [PATCH] Renamed members-email-labs to newsletters and removed unused files MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit no issue We still had some old components and templates from the `members-email` settings that were only were used when the (now GA) `multipleNewsletters` flag was disabled. I’ve removed them and renamed all routes and components from `members-email` and `members-email-labs` to just `newsletters` because it was sometimes hard to understand if a given components was still used or not when fixing issues. --- .../gh-post-settings-menu/email.hbs | 4 +- .../newsletters/verify-newsletter-email.hbs | 4 +- .../app/components/settings/members-email.hbs | 246 ------------------ .../app/components/settings/members-email.js | 225 ---------------- ...members-email-labs.hbs => newsletters.hbs} | 4 +- .../{members-email-labs.js => newsletters.js} | 2 +- .../newsletter-management.hbs | 8 +- .../newsletter-management.js | 2 +- .../app/controllers/settings/members-email.js | 74 ------ .../{members-email-labs.js => newsletters.js} | 2 +- ghost/admin/app/router.js | 7 +- .../app/routes/settings/members-email.js | 41 +-- .../{members-email-labs.js => newsletters.js} | 10 +- .../edit-newsletter.js | 4 +- .../new-newsletter.js | 4 +- ghost/admin/app/templates/dashboard.hbs | 2 +- ghost/admin/app/templates/settings.hbs | 4 +- .../app/templates/settings/members-email.hbs | 48 ---- ...members-email-labs.hbs => newsletters.hbs} | 4 +- .../acceptance/settings/members-email-test.js | 39 --- ...email-labs-test.js => newsletters-test.js} | 12 +- 21 files changed, 33 insertions(+), 713 deletions(-) delete mode 100644 ghost/admin/app/components/settings/members-email.hbs delete mode 100644 ghost/admin/app/components/settings/members-email.js rename ghost/admin/app/components/settings/{members-email-labs.hbs => newsletters.hbs} (99%) rename ghost/admin/app/components/settings/{members-email-labs.js => newsletters.js} (98%) rename ghost/admin/app/components/settings/{members-email-labs => newsletters}/newsletter-management.hbs (91%) rename ghost/admin/app/components/settings/{members-email-labs => newsletters}/newsletter-management.js (98%) delete mode 100644 ghost/admin/app/controllers/settings/members-email.js rename ghost/admin/app/controllers/settings/{members-email-labs.js => newsletters.js} (85%) rename ghost/admin/app/routes/settings/{members-email-labs.js => newsletters.js} (88%) rename ghost/admin/app/routes/settings/{members-email-labs => newsletters}/edit-newsletter.js (94%) rename ghost/admin/app/routes/settings/{members-email-labs => newsletters}/new-newsletter.js (88%) delete mode 100644 ghost/admin/app/templates/settings/members-email.hbs rename ghost/admin/app/templates/settings/{members-email-labs.hbs => newsletters.hbs} (94%) delete mode 100644 ghost/admin/tests/acceptance/settings/members-email-test.js rename ghost/admin/tests/acceptance/settings/{members-email-labs-test.js => newsletters-test.js} (92%) diff --git a/ghost/admin/app/components/gh-post-settings-menu/email.hbs b/ghost/admin/app/components/gh-post-settings-menu/email.hbs index 24573120f6..af1e45bc32 100644 --- a/ghost/admin/app/components/gh-post-settings-menu/email.hbs +++ b/ghost/admin/app/components/gh-post-settings-menu/email.hbs @@ -89,7 +89,7 @@ {{#if this.mailgunError}}

{{svg-jar "info" class="w5 h5 fill-yellow nl1"}} - You need to configure Mailgun in Settings → Email newsletter to enable email newsletters. + You need to configure Mailgun in Settings → Email newsletter to enable email newsletters.

{{/if}} @@ -147,4 +147,4 @@ {{/if}} - \ No newline at end of file + diff --git a/ghost/admin/app/components/modals/newsletters/verify-newsletter-email.hbs b/ghost/admin/app/components/modals/newsletters/verify-newsletter-email.hbs index 9bf758b998..6f2e0905f4 100644 --- a/ghost/admin/app/components/modals/newsletters/verify-newsletter-email.hbs +++ b/ghost/admin/app/components/modals/newsletters/verify-newsletter-email.hbs @@ -12,7 +12,7 @@ {{else if this.newsletter}}

Success! From address for newsletter - "{{this.newsletter.name}}" + "{{this.newsletter.name}}" changed to {{this.newsletter.senderEmail}}

{{else if this.error}} @@ -31,4 +31,4 @@ Ok - \ No newline at end of file + diff --git a/ghost/admin/app/components/settings/members-email.hbs b/ghost/admin/app/components/settings/members-email.hbs deleted file mode 100644 index e99946d5e4..0000000000 --- a/ghost/admin/app/components/settings/members-email.hbs +++ /dev/null @@ -1,246 +0,0 @@ -
-
-
-
-
-

Enable newsletter sending

-

Newsletter features are active, posts can be sent by email

-
-
- -
-
-
-
-
- -{{#if this.emailNewsletterEnabled}} - -
-
-
-
-
-

Email design

-

Customize the look and feel of your newsletters

-
- -
-
-
-
- -
- -
-
-
-
-
-
-

Default newsletter recipients

-

When you publish new content, who do you usually want to send it to?

-
-
- -
-
-
-
-
-
-

Email addresses

-

Contact information used for newsletters and member login emails

-
- -
-
- {{#liquid-if this.membersFromOpen}} -
- - -
- - -
-

The address your newsletter posts are sent from

-
- {{#if this.showFromAddressConfirmation}} -
- {{svg-jar "check-circle" class="w4 h4 mr1 stroke-green-d1"}} Check your inbox and confirm before saving your settings -
- {{/if}} -
- - - - {{one-way-select this.selectedReplyAddress - id="reply-address" - name="reply-address" - options=(readonly this.replyAddresses) - optionValuePath="value" - optionLabelPath="label" - update=(action "setReplyAddress") - }} - {{svg-jar "arrow-down-small"}} - -
-

Where you receive responses to newsletters

- {{#if (eq this.settings.membersReplyAddress "support")}} - Change support email address - {{/if}} -
-
- {{/liquid-if}} -
-
-
-
-
-
-
-

Enable newsletter open-rate

-

Track how many members are reading your emails

-
-
- -
-
-
-
-
-
-

Preview

-
-
-
Ready to {{#if this.emailPreviewVisible}} publish & send {{else}} publish {{/if}}{{svg-jar "arrow-down"}} this post?
-
-
-
-
-
-
Set it live now
-
-
-
-
-
-
Schedule it for later
-
-
-
- {{#if this.emailPreviewVisible}} -
-
-
- -
- -
-
-
-
- {{/if}} -
-
-
-
-
- - {{#unless this.config.mailgunIsConfigured}} -
-
-

Advanced

-
-
-
-
-

Mailgun configuration

-

The Mailgun API is used for bulk email newsletter delivery. Why is this required?

-
- -
-
- {{#liquid-if this.membersEmailOpen}} -
- -
- - -
- - {{region.flag}} {{region.name}} - -
-
- - - - -
-

Find your Mailgun region and domain - here -

-
- - - -

Find your Mailgun API keys - here -

-
-
- {{/liquid-if}} -
-
-
-
- {{/unless}} - -{{/if}} \ No newline at end of file diff --git a/ghost/admin/app/components/settings/members-email.js b/ghost/admin/app/components/settings/members-email.js deleted file mode 100644 index 29fdb147a4..0000000000 --- a/ghost/admin/app/components/settings/members-email.js +++ /dev/null @@ -1,225 +0,0 @@ -import Component from '@ember/component'; -import classic from 'ember-classic-decorator'; -import {action, computed} from '@ember/object'; -import {inject as service} from '@ember/service'; -import {task} from 'ember-concurrency'; - -const US = {flag: '🇺🇸', name: 'US', baseUrl: 'https://api.mailgun.net/v3'}; -const EU = {flag: '🇪🇺', name: 'EU', baseUrl: 'https://api.eu.mailgun.net/v3'}; - -@classic -export default class MembersEmail extends Component { - @service config; - @service ghostPaths; - @service ajax; - @service settings; - - replyAddresses = null; - recipientsSelectValue = null; - showFromAddressConfirmation = false; - showEmailDesignSettings = false; - - @computed('settings.editorDefaultEmailRecipients') - get emailNewsletterEnabled() { - return this.get('settings.editorDefaultEmailRecipients') !== 'disabled'; - } - - @computed('recipientsSelectValue') - get emailPreviewVisible() { - return this.recipientsSelectValue !== 'none'; - } - - @computed('settings.membersReplyAddress') - get selectedReplyAddress() { - return this.replyAddresses.findBy('value', this.get('settings.membersReplyAddress')); - } - - @computed('fromAddress') - get disableUpdateFromAddressButton() { - const savedFromAddress = this.get('settings.membersFromAddress') || ''; - if (!savedFromAddress.includes('@') && this.config.emailDomain) { - return !this.fromAddress || (this.fromAddress === `${savedFromAddress}@${this.config.emailDomain}`); - } - return !this.fromAddress || (this.fromAddress === savedFromAddress); - } - - @computed('settings.mailgunBaseUrl') - get mailgunRegion() { - if (!this.settings.get('mailgunBaseUrl')) { - return US; - } - - return [US, EU].find((region) => { - return region.baseUrl === this.settings.get('mailgunBaseUrl'); - }); - } - - @computed('settings.{mailgunBaseUrl,mailgunApiKey,mailgunDomain}') - get mailgunSettings() { - return { - apiKey: this.get('settings.mailgunApiKey') || '', - domain: this.get('settings.mailgunDomain') || '', - baseUrl: this.get('settings.mailgunBaseUrl') || '' - }; - } - - init() { - super.init(...arguments); - this.set('mailgunRegions', [US, EU]); - this.set('replyAddresses', [ - { - label: 'Newsletter email address (' + this.fromAddress + ')', - value: 'newsletter' - }, - { - label: 'Support email address (' + this.supportAddress + ')', - value: 'support' - } - ]); - - // set recipientsSelectValue as a static property because within this - // component's lifecycle it's not always derived from the settings values. - // e.g. can be set to "segment" when the filter is empty which is not derivable - // from settings as it would equate to "none" - this.set('recipientsSelectValue', this._getDerivedRecipientsSelectValue()); - } - - @action - toggleFromAddressConfirmation() { - this.toggleProperty('showFromAddressConfirmation'); - } - - @action - closeEmailDesignSettings() { - this.set('showEmailDesignSettings', false); - } - - @action - setMailgunDomain(event) { - this.set('settings.mailgunDomain', event.target.value); - if (!this.get('settings.mailgunBaseUrl')) { - this.set('settings.mailgunBaseUrl', this.mailgunRegion.baseUrl); - } - } - - @action - setMailgunApiKey(event) { - this.set('settings.mailgunApiKey', event.target.value); - if (!this.get('settings.mailgunBaseUrl')) { - this.set('settings.mailgunBaseUrl', this.mailgunRegion.baseUrl); - } - } - - @action - setMailgunRegion(region) { - this.set('settings.mailgunBaseUrl', region.baseUrl); - } - - @action - setFromAddress(fromAddress) { - this.setEmailAddress('fromAddress', fromAddress); - } - - @action - toggleEmailTrackOpens(event) { - if (event) { - event.preventDefault(); - } - this.set('settings.emailTrackOpens', !this.settings.get('emailTrackOpens')); - } - - @action - toggleEmailNewsletterEnabled(event) { - if (event) { - event.preventDefault(); - } - - const newsletterEnabled = !this.emailNewsletterEnabled; - - if (newsletterEnabled) { - this.set('settings.editorDefaultEmailRecipients', 'visibility'); - } else { - this.set('settings.editorDefaultEmailRecipients', 'disabled'); - this.set('settings.editorDefaultEmailRecipientsFilter', null); - } - - this.set('recipientsSelectValue', this._getDerivedRecipientsSelectValue()); - } - - @action - setReplyAddress(event) { - const newReplyAddress = event.value; - - this.set('settings.membersReplyAddress', newReplyAddress); - } - - @action - setDefaultEmailRecipients(value) { - // Update the underlying setting properties to match the selected recipients option - - if (['visibility', 'disabled'].includes(value)) { - this.settings.set('editorDefaultEmailRecipients', value); - this.settings.set('editorDefaultEmailRecipientsFilter', null); - } else { - this.settings.set('editorDefaultEmailRecipients', 'filter'); - } - - if (value === 'all-members') { - this.settings.set('editorDefaultEmailRecipientsFilter', 'status:free,status:-free'); - } - - if (value === 'paid-only') { - this.settings.set('editorDefaultEmailRecipientsFilter', 'status:-free'); - } - - if (value === 'none') { - this.settings.set('editorDefaultEmailRecipientsFilter', null); - } - - // Update the value used to display the selected recipients option explicitly - // because it's local non-derived state - this.set('recipientsSelectValue', value); - } - - @action - setDefaultEmailRecipientsFilter(filter) { - this.settings.set('editorDefaultEmailRecipientsFilter', filter); - } - - @(task(function* () { - let url = this.get('ghostPaths.url').api('/settings/members/email'); - try { - const response = yield this.ajax.post(url, { - data: { - email: this.fromAddress, - type: 'fromAddressUpdate' - } - }); - this.toggleProperty('showFromAddressConfirmation'); - return response; - } catch (e) { - // Failed to send email, retry - return false; - } - }).drop()) - updateFromAddress; - - _getDerivedRecipientsSelectValue() { - const defaultEmailRecipients = this.settings.get('editorDefaultEmailRecipients'); - const defaultEmailRecipientsFilter = this.settings.get('editorDefaultEmailRecipientsFilter'); - - if (defaultEmailRecipients === 'filter') { - if (defaultEmailRecipientsFilter === 'status:free,status:-free') { - return 'all-members'; - } else if (defaultEmailRecipientsFilter === 'status:-free') { - return 'paid-only'; - } else if (defaultEmailRecipientsFilter === null) { - return 'none'; - } else { - return 'segment'; - } - } - - return defaultEmailRecipients; - } -} diff --git a/ghost/admin/app/components/settings/members-email-labs.hbs b/ghost/admin/app/components/settings/newsletters.hbs similarity index 99% rename from ghost/admin/app/components/settings/members-email-labs.hbs rename to ghost/admin/app/components/settings/newsletters.hbs index cfacfe11b2..4c60897fc1 100644 --- a/ghost/admin/app/components/settings/members-email-labs.hbs +++ b/ghost/admin/app/components/settings/newsletters.hbs @@ -25,7 +25,7 @@ {{#if this.emailNewsletterEnabled}} - +

General settings

@@ -164,4 +164,4 @@
-{{/if}} \ No newline at end of file +{{/if}} diff --git a/ghost/admin/app/components/settings/members-email-labs.js b/ghost/admin/app/components/settings/newsletters.js similarity index 98% rename from ghost/admin/app/components/settings/members-email-labs.js rename to ghost/admin/app/components/settings/newsletters.js index 4c9dfb5b4c..6f0d654e09 100644 --- a/ghost/admin/app/components/settings/members-email-labs.js +++ b/ghost/admin/app/components/settings/newsletters.js @@ -6,7 +6,7 @@ import {tracked} from '@glimmer/tracking'; const US = {flag: '🇺🇸', name: 'US', baseUrl: 'https://api.mailgun.net/v3'}; const EU = {flag: '🇪🇺', name: 'EU', baseUrl: 'https://api.eu.mailgun.net/v3'}; -export default class MembersEmailLabs extends Component { +export default class Newsletters extends Component { @service config; @service settings; diff --git a/ghost/admin/app/components/settings/members-email-labs/newsletter-management.hbs b/ghost/admin/app/components/settings/newsletters/newsletter-management.hbs similarity index 91% rename from ghost/admin/app/components/settings/members-email-labs/newsletter-management.hbs rename to ghost/admin/app/components/settings/newsletters/newsletter-management.hbs index d43e05f90d..98e8d19365 100644 --- a/ghost/admin/app/components/settings/members-email-labs/newsletter-management.hbs +++ b/ghost/admin/app/components/settings/newsletters/newsletter-management.hbs @@ -64,7 +64,7 @@

{{else}} - +

{{newsletter.name}}

@@ -87,7 +87,7 @@ {{/if}}
{{#if this.displayingDefault}} - Customize → + Customize → {{else}} @@ -99,7 +99,7 @@
{{#if (feature "multipleNewslettersUI")}} - {{svg-jar "add-stroke"}}Add newsletter + {{svg-jar "add-stroke"}}Add newsletter {{/if}} diff --git a/ghost/admin/app/components/settings/members-email-labs/newsletter-management.js b/ghost/admin/app/components/settings/newsletters/newsletter-management.js similarity index 98% rename from ghost/admin/app/components/settings/members-email-labs/newsletter-management.js rename to ghost/admin/app/components/settings/newsletters/newsletter-management.js index b77576fd43..c5cf96c484 100644 --- a/ghost/admin/app/components/settings/members-email-labs/newsletter-management.js +++ b/ghost/admin/app/components/settings/newsletters/newsletter-management.js @@ -65,7 +65,7 @@ export default class NewsletterManagementComponent extends Component { // an explicit tracked filteredNewsletters property rather than using a reactive // getter that automatically displays newly added newsletters - if (transition.from.name === 'settings.members-email-labs.new-newsletter') { + if (transition.from.name === 'settings.newsletters.new-newsletter') { this.updateFilteredNewsletters(); } } diff --git a/ghost/admin/app/controllers/settings/members-email.js b/ghost/admin/app/controllers/settings/members-email.js deleted file mode 100644 index 21ee2429e4..0000000000 --- a/ghost/admin/app/controllers/settings/members-email.js +++ /dev/null @@ -1,74 +0,0 @@ -import Controller from '@ember/controller'; -import {action} from '@ember/object'; -import {inject as service} from '@ember/service'; -import {task} from 'ember-concurrency'; -import {tracked} from '@glimmer/tracking'; - -export default class MembersEmailController extends Controller { - @service config; - @service session; - @service settings; - - queryParams = ['showEmailDesignSettings']; - - // from/supportAddress are set here so that they can be reset to saved values on save - // to avoid it looking like they've been saved when they have a separate update process - @tracked fromAddress = ''; - @tracked supportAddress = ''; - - @tracked showEmailDesignSettings = false; - @tracked showLeaveSettingsModal = false; - - @action - setEmailAddress(property, email) { - this[property] = email; - } - - @action - toggleEmailDesignSettings() { - this.showEmailDesignSettings = !this.showEmailDesignSettings; - } - - leaveRoute(transition) { - if (this.settings.get('hasDirtyAttributes')) { - transition.abort(); - this.leaveSettingsTransition = transition; - this.showLeaveSettingsModal = true; - } - this.showEmailDesignSettings = false; - } - - @action - async confirmLeave() { - this.settings.rollbackAttributes(); - this.showLeaveSettingsModal = false; - this.leaveSettingsTransition.retry(); - } - - @action - cancelLeave() { - this.showLeaveSettingsModal = false; - this.leaveSettingsTransition = null; - } - - parseEmailAddress(address) { - const emailAddress = address || 'noreply'; - // Adds default domain as site domain - if (emailAddress.indexOf('@') < 0 && this.config.emailDomain) { - return `${emailAddress}@${this.config.emailDomain}`; - } - return emailAddress; - } - - resetEmailAddresses() { - this.fromAddress = this.parseEmailAddress(this.settings.get('membersFromAddress')); - this.supportAddress = this.parseEmailAddress(this.settings.get('membersSupportAddress')); - } - - @task({drop: true}) - *saveSettings() { - const response = yield this.settings.save(); - this.resetEmailAddresses(); - return response; - } -} diff --git a/ghost/admin/app/controllers/settings/members-email-labs.js b/ghost/admin/app/controllers/settings/newsletters.js similarity index 85% rename from ghost/admin/app/controllers/settings/members-email-labs.js rename to ghost/admin/app/controllers/settings/newsletters.js index 28b2f99ca2..979694b0d3 100644 --- a/ghost/admin/app/controllers/settings/members-email-labs.js +++ b/ghost/admin/app/controllers/settings/newsletters.js @@ -3,7 +3,7 @@ import {inject as service} from '@ember/service'; import {task} from 'ember-concurrency'; import {tracked} from '@glimmer/tracking'; -export default class MembersEmailLabsController extends Controller { +export default class NewslettersController extends Controller { @service settings; queryParams = ['verifyEmail']; diff --git a/ghost/admin/app/router.js b/ghost/admin/app/router.js index 10c7451349..8df634f0e8 100644 --- a/ghost/admin/app/router.js +++ b/ghost/admin/app/router.js @@ -42,10 +42,11 @@ Router.map(function () { this.route('settings'); this.route('settings.general', {path: '/settings/general'}); this.route('settings.membership', {path: '/settings/members'}); - this.route('settings.members-email', {path: '/settings/members-email'}); this.route('settings.code-injection', {path: '/settings/code-injection'}); - - this.route('settings.members-email-labs', {path: '/settings/newsletters'}, function () { + + // redirect from old /settings/members-email to /settings/newsletters + this.route('settings.members-email', {path: '/settings/members-email'}); + this.route('settings.newsletters', {path: '/settings/newsletters'}, function () { this.route('new-newsletter', {path: 'new'}); this.route('edit-newsletter', {path: ':newsletter_id'}); }); diff --git a/ghost/admin/app/routes/settings/members-email.js b/ghost/admin/app/routes/settings/members-email.js index c9bffb0701..26d0ef64cb 100644 --- a/ghost/admin/app/routes/settings/members-email.js +++ b/ghost/admin/app/routes/settings/members-email.js @@ -1,43 +1,8 @@ import AdminRoute from 'ghost-admin/routes/admin'; -import {action} from '@ember/object'; -import {inject as service} from '@ember/service'; export default class MembersEmailRoute extends AdminRoute { - @service feature; - @service notifications; - @service settings; - - beforeModel(transition) { - super.beforeModel(...arguments); - - if (this.feature.multipleNewsletters) { - return this.transitionTo('settings.members-email-labs'); - } - - if (transition.to.queryParams?.fromAddressUpdate === 'success') { - this.notifications.showAlert( - `Newsletter email address has been updated`, - {type: 'success', key: 'members.settings.from-address.updated'} - ); - } - } - - model() { - return this.settings.reload(); - } - - setupController(controller) { - controller.resetEmailAddresses(); - } - - @action - willTransition(transition) { - return this.controller.leaveRoute(transition); - } - - buildRouteInfoMetadata() { - return { - titleToken: 'Settings - Email newsletter' - }; + beforeModel() { + // Moved to newsletters + return this.replaceWith('settings.newsletters'); } } diff --git a/ghost/admin/app/routes/settings/members-email-labs.js b/ghost/admin/app/routes/settings/newsletters.js similarity index 88% rename from ghost/admin/app/routes/settings/members-email-labs.js rename to ghost/admin/app/routes/settings/newsletters.js index 9c4156e56d..ad3a536d5d 100644 --- a/ghost/admin/app/routes/settings/members-email-labs.js +++ b/ghost/admin/app/routes/settings/newsletters.js @@ -19,14 +19,6 @@ export default class MembersEmailLabsRoute extends AdminRoute { confirmModal = null; hasConfirmed = false; - beforeModel() { - super.beforeModel(...arguments); - - if (!this.feature.multipleNewsletters) { - return this.transitionTo('settings.members-email'); - } - } - model() { return this.settings.reload(); } @@ -39,7 +31,7 @@ export default class MembersEmailLabsRoute extends AdminRoute { // clear query param so it doesn't linger and cause problems re-entering route transition.abort(); - return this.transitionTo('settings.members-email-labs', {queryParams: {verifyEmail: null}}); + return this.transitionTo('settings.newsletters', {queryParams: {verifyEmail: null}}); } } diff --git a/ghost/admin/app/routes/settings/members-email-labs/edit-newsletter.js b/ghost/admin/app/routes/settings/newsletters/edit-newsletter.js similarity index 94% rename from ghost/admin/app/routes/settings/members-email-labs/edit-newsletter.js rename to ghost/admin/app/routes/settings/newsletters/edit-newsletter.js index e98cf38866..0d93661315 100644 --- a/ghost/admin/app/routes/settings/members-email-labs/edit-newsletter.js +++ b/ghost/admin/app/routes/settings/newsletters/edit-newsletter.js @@ -28,7 +28,7 @@ export default class EditNewsletterRoute extends AdminRoute { @action afterSave() { - this.router.transitionTo('settings.members-email-labs'); + this.router.transitionTo('settings.newsletters'); } deactivate() { @@ -88,7 +88,7 @@ export default class EditNewsletterRoute extends AdminRoute { const shouldLeave = await this.confirmUnsavedChanges(); if (shouldLeave && !this.isLeaving) { - this.router.transitionTo('settings.members-email-labs'); + this.router.transitionTo('settings.newsletters'); return true; } diff --git a/ghost/admin/app/routes/settings/members-email-labs/new-newsletter.js b/ghost/admin/app/routes/settings/newsletters/new-newsletter.js similarity index 88% rename from ghost/admin/app/routes/settings/members-email-labs/new-newsletter.js rename to ghost/admin/app/routes/settings/newsletters/new-newsletter.js index 2d4e3e997a..6945b3d450 100644 --- a/ghost/admin/app/routes/settings/members-email-labs/new-newsletter.js +++ b/ghost/admin/app/routes/settings/newsletters/new-newsletter.js @@ -28,7 +28,7 @@ export default class NewNewsletterRoute extends AdminRoute { @action afterSave() { - this.router.transitionTo('settings.members-email-labs'); + this.router.transitionTo('settings.newsletters'); } deactivate() { @@ -40,7 +40,7 @@ export default class NewNewsletterRoute extends AdminRoute { @action async beforeModalClose() { if (!this.isLeaving) { - this.router.transitionTo('settings.members-email-labs'); + this.router.transitionTo('settings.newsletters'); } } } diff --git a/ghost/admin/app/templates/dashboard.hbs b/ghost/admin/app/templates/dashboard.hbs index 0a7d56648c..935b19556f 100644 --- a/ghost/admin/app/templates/dashboard.hbs +++ b/ghost/admin/app/templates/dashboard.hbs @@ -73,7 +73,7 @@
diff --git a/ghost/admin/app/templates/settings.hbs b/ghost/admin/app/templates/settings.hbs index d1c3a77afd..d7ec205582 100644 --- a/ghost/admin/app/templates/settings.hbs +++ b/ghost/admin/app/templates/settings.hbs @@ -48,7 +48,7 @@

Access, subscription, and pricing options

- + {{svg-jar "email-stroke"}}

Email newsletter

@@ -91,4 +91,4 @@ @confirm={{action "leavePortalSettings"}} @close={{action "closeLeaveSettingsModal"}} @modifier="action wide" /> -{{/if}} \ No newline at end of file +{{/if}} diff --git a/ghost/admin/app/templates/settings/members-email.hbs b/ghost/admin/app/templates/settings/members-email.hbs deleted file mode 100644 index 7ace9373b9..0000000000 --- a/ghost/admin/app/templates/settings/members-email.hbs +++ /dev/null @@ -1,48 +0,0 @@ -
- -

- Settings - {{svg-jar "arrow-right"}} - Email newsletter -

-
- -
-
- -
-
- -
-
- - {{#if this.showLeaveSettingsModal}} - - {{/if}} -
- -{{#if this.showEmailDesignSettings}} - - - -{{/if}} \ No newline at end of file diff --git a/ghost/admin/app/templates/settings/members-email-labs.hbs b/ghost/admin/app/templates/settings/newsletters.hbs similarity index 94% rename from ghost/admin/app/templates/settings/members-email-labs.hbs rename to ghost/admin/app/templates/settings/newsletters.hbs index 4c2511febf..a63cfe42e3 100644 --- a/ghost/admin/app/templates/settings/members-email-labs.hbs +++ b/ghost/admin/app/templates/settings/newsletters.hbs @@ -20,7 +20,7 @@
- +
- \ No newline at end of file + diff --git a/ghost/admin/tests/acceptance/settings/members-email-test.js b/ghost/admin/tests/acceptance/settings/members-email-test.js deleted file mode 100644 index 9adf009050..0000000000 --- a/ghost/admin/tests/acceptance/settings/members-email-test.js +++ /dev/null @@ -1,39 +0,0 @@ -import {authenticateSession} from 'ember-simple-auth/test-support'; -import {click, currentURL, find} from '@ember/test-helpers'; -import {expect} from 'chai'; -import {setupApplicationTest} from 'ember-mocha'; -import {setupMirage} from 'ember-cli-mirage/test-support'; -import {visit} from '../../helpers/visit'; - -describe('Acceptance: Settings - Members email', function () { - const hooks = setupApplicationTest(); - setupMirage(hooks); - - beforeEach(async function () { - this.server.loadFixtures('configs'); - - const role = this.server.create('role', {name: 'Owner'}); - this.server.create('user', {roles: [role]}); - - return await authenticateSession(); - }); - - it('loads non-labs route', async function () { - await visit('/settings/members-email'); - expect(currentURL()).to.equal('/settings/members-email'); - }); - - it('can manage open rate tracking', async function () { - this.server.db.settings.update({key: 'email_track_opens'}, {value: 'true'}); - - await visit('/settings/members-email'); - expect(find('[data-test-checkbox="email-track-opens"]')).to.be.checked; - - await click('label[for="email-track-opens"]'); - expect(find('[data-test-checkbox="email-track-opens"]')).to.not.be.checked; - - await click('[data-test-button="save-members-settings"]'); - - expect(this.server.db.settings.findBy({key: 'email_track_opens'}).value).to.equal(false); - }); -}); diff --git a/ghost/admin/tests/acceptance/settings/members-email-labs-test.js b/ghost/admin/tests/acceptance/settings/newsletters-test.js similarity index 92% rename from ghost/admin/tests/acceptance/settings/members-email-labs-test.js rename to ghost/admin/tests/acceptance/settings/newsletters-test.js index fd420459f2..dbbcd67115 100644 --- a/ghost/admin/tests/acceptance/settings/members-email-labs-test.js +++ b/ghost/admin/tests/acceptance/settings/newsletters-test.js @@ -1,12 +1,12 @@ import {authenticateSession} from 'ember-simple-auth/test-support'; import {click, currentURL, fillIn, find, findAll} from '@ember/test-helpers'; -import {disableLabsFlag, enableLabsFlag} from '../../helpers/labs-flag'; +import {enableLabsFlag} from '../../helpers/labs-flag'; import {expect} from 'chai'; import {setupApplicationTest} from 'ember-mocha'; import {setupMirage} from 'ember-cli-mirage/test-support'; import {visit} from '../../helpers/visit'; -describe('Acceptance: Settings - Members email (multipleNewsletters)', function () { +describe('Acceptance: Settings - Newsletters (multipleNewsletters)', function () { const hooks = setupApplicationTest(); setupMirage(hooks); @@ -21,12 +21,6 @@ describe('Acceptance: Settings - Members email (multipleNewsletters)', function return await authenticateSession(); }); - it('without flag - redirects labs to original', async function () { - disableLabsFlag(this.server, 'multipleNewsletters'); - await visit('/settings/newsletters'); - expect(currentURL()).to.equal('/settings/members-email'); - }); - it('with flag - redirects original to labs', async function () { await visit('/settings/members-email'); expect(currentURL()).to.equal('/settings/newsletters'); @@ -47,7 +41,7 @@ describe('Acceptance: Settings - Members email (multipleNewsletters)', function }); }); -describe('Acceptance: Settings - Members email (multipleNewslettersUI)', function () { +describe('Acceptance: Settings - Newsletters (multipleNewslettersUI)', function () { const hooks = setupApplicationTest(); setupMirage(hooks);