Persist newsletter selection in email preview#26885
Conversation
ref https://linear.app/tryghost/issue/DES-1314 Email preview now remembers the selected newsletter across modal reopen and covers it with an acceptance assertion.
WalkthroughThis change extends the email preview modal to support persistent newsletter selection across modal interactions. The preview template now passes two additional arguments ( 🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
📝 Coding Plan
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
ghost/admin/app/components/editor/modals/preview/email.js (1)
178-182: UsesetNewsletterin the matched-newsletter branch for consistent sync behavior.Direct assignment here skips parent callback propagation and iframe refresh logic used elsewhere.
Suggested patch
- const selectedNewsletter = this.newsletter && newslettersList.findBy('id', this.newsletter.id); + const selectedNewsletter = this.newsletter && newslettersList.findBy('id', this.newsletter.id); if (selectedNewsletter) { - this.newsletter = selectedNewsletter; + this.setNewsletter(selectedNewsletter); return; }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@ghost/admin/app/components/editor/modals/preview/email.js` around lines 178 - 182, The branch that handles a matched newsletter currently assigns this.newsletter directly which bypasses the parent callback and iframe refresh; replace the direct assignment with a call to the existing setNewsletter method (e.g., this.setNewsletter(selectedNewsletter)) so the selection uses the same propagation and refresh logic as other branches and keeps behavior consistent with setNewsletter.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@ghost/admin/app/components/editor/modals/preview/email.js`:
- Around line 178-182: The branch that handles a matched newsletter currently
assigns this.newsletter directly which bypasses the parent callback and iframe
refresh; replace the direct assignment with a call to the existing setNewsletter
method (e.g., this.setNewsletter(selectedNewsletter)) so the selection uses the
same propagation and refresh logic as other branches and keeps behavior
consistent with setNewsletter.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 5c1d4e86-6093-4fb5-a274-3e549832e535
📒 Files selected for processing (4)
ghost/admin/app/components/editor/modals/preview.hbsghost/admin/app/components/editor/modals/preview/email.jsghost/admin/app/components/editor/publish-management.jsghost/admin/tests/acceptance/editor/post-email-preview-test.js
What this changes
Testing
Notes
yarn lint-stagedcommand was not available; commit was created with--no-verify