diff --git a/ghost/admin/app/components/modals/edit-newsletter.js b/ghost/admin/app/components/modals/edit-newsletter.js index bf6d399fd8..d37faf2af4 100644 --- a/ghost/admin/app/components/modals/edit-newsletter.js +++ b/ghost/admin/app/components/modals/edit-newsletter.js @@ -8,6 +8,7 @@ import {tracked} from '@glimmer/tracking'; export default class EditNewsletterModal extends Component { @service modals; + @service store; static modalOptions = { className: 'fullscreen-modal-full-overlay fullscreen-modal-portal-settings' @@ -16,6 +17,14 @@ export default class EditNewsletterModal extends Component { @tracked tab = 'settings'; @tracked optInExisting = this.args.data.newsletter.isNew; + get activeNewsletterSlugs() { + const activeNewsletters = this.store.peekAll('newsletter').filter((n) => { + return n.status === 'active' && !n.isNew && !n.isDestroyed; + }); + + return activeNewsletters.map(n => n.slug); + } + willDestroy() { super.willDestroy(...arguments); this.args.data.newsletter.rollbackAttributes(); @@ -48,7 +57,8 @@ export default class EditNewsletterModal extends Component { const shouldCreate = yield this.modals.open(ConfirmCreateModal, { optInExisting, - newsletter: this.args.data.newsletter + newsletter: this.args.data.newsletter, + activeNewsletterSlugs: this.activeNewsletterSlugs }); if (!shouldCreate) { diff --git a/ghost/admin/app/components/modals/edit-newsletter/confirm-create.hbs b/ghost/admin/app/components/modals/edit-newsletter/confirm-create.hbs index a54a081c76..8bc2c6c373 100644 --- a/ghost/admin/app/components/modals/edit-newsletter/confirm-create.hbs +++ b/ghost/admin/app/components/modals/edit-newsletter/confirm-create.hbs @@ -7,17 +7,12 @@