Skip to content

Started using sender details from email design settings, when available, for automations#28496

Open
EvanHahn wants to merge 5 commits into
mainfrom
read-sender-details-from-design-settings-when-available
Open

Started using sender details from email design settings, when available, for automations#28496
EvanHahn wants to merge 5 commits into
mainfrom
read-sender-details-from-design-settings-when-available

Conversation

@EvanHahn

Copy link
Copy Markdown
Contributor

towards https://linear.app/ghost/issue/NY-1308
towards https://linear.app/ghost/issue/NY-1333
ref #28461
ref #28326

I recommend reviewing this commit-by-commit.

Now that the email_design_settings table has sender details, let's start using them for automations.

This change should have no user impact yet, because we aren't reading/writing these fields. That will change soon!

@coderabbitai

coderabbitai Bot commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: ae6e43cf-fad5-44d5-a818-6658d3bdd5bd

📥 Commits

Reviewing files that changed from the base of the PR and between 70db530 and c123c7c.

⛔ Files ignored due to path filters (1)
  • ghost/core/test/e2e-api/admin/__snapshots__/automations.test.js.snap is excluded by !**/*.snap
📒 Files selected for processing (14)
  • apps/admin-x-framework/src/api/automations.ts
  • apps/admin-x-framework/test/unit/api/automations.test.ts
  • apps/posts/test/unit/views/automations/automation-editor.test.tsx
  • ghost/core/core/server/services/automations/automations-api.ts
  • ghost/core/core/server/services/automations/automations-repository.ts
  • ghost/core/core/server/services/automations/fake-database-automations-repository.ts
  • ghost/core/core/server/services/automations/poll.ts
  • ghost/core/core/server/services/automations/temporary-fake-database.ts
  • ghost/core/core/server/services/member-welcome-emails/service.js
  • ghost/core/test/e2e-api/admin/automations.test.js
  • ghost/core/test/e2e-api/members/automations.test.js
  • ghost/core/test/integration/services/member-welcome-emails.test.js
  • ghost/core/test/unit/server/services/automations/automations-api.test.js
  • ghost/core/test/unit/server/services/automations/poll.test.ts
💤 Files with no reviewable changes (8)
  • ghost/core/core/server/services/automations/automations-api.ts
  • apps/posts/test/unit/views/automations/automation-editor.test.tsx
  • ghost/core/core/server/services/automations/automations-repository.ts
  • ghost/core/test/unit/server/services/automations/automations-api.test.js
  • ghost/core/test/e2e-api/admin/automations.test.js
  • apps/admin-x-framework/src/api/automations.ts
  • ghost/core/core/server/services/automations/poll.ts
  • ghost/core/core/server/services/automations/fake-database-automations-repository.ts

Walkthrough

This PR refactors the automation send_email action to remove discrete sender identity fields (email_sender_name, email_sender_email, email_sender_reply_to) and instead use an email_design_setting_id reference for sender resolution. The type contracts are updated across the framework, repository layer, and API validation. The fake database implementation removes sender field propagation from type definitions, SQL queries, and payload construction. The member welcome email service is refactored to derive sender from/replyTo from email design settings JSON. Tests across unit, integration, and E2E layers are updated to reflect the new payload shape and sender resolution path.

Possibly related PRs

  • TryGhost/Ghost#28461: Adds sender_name, sender_email, and sender_reply_to columns to email_design_settings table, which enables this PR's migration of sender identity lookup to that table.
  • TryGhost/Ghost#28364: Updates buildSendEmailAction() and automations-api for subject/body validation, overlapping with the same send_email action shape modifications in this PR.
  • TryGhost/Ghost#28120: Introduces AutomationStepToRun and poll execution for send_email, which are refactored in this PR to remove sender field handling.

Suggested labels

automation, refactor, database-schema

Suggested reviewers

  • troyciesco
  • cmraible
🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The PR title accurately summarizes the main change: moving from discrete sender fields to using email design settings for automations.
Description check ✅ Passed The description clearly relates to the changeset by explaining the refactoring toward email design settings and referencing relevant issues and prior PRs.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch read-sender-details-from-design-settings-when-available

Warning

Review ran into problems

🔥 Problems

Stopped waiting for pipeline failures after 30000ms. One of your pipelines takes longer than our 30000ms fetch window to run, so review may not consider pipeline-failure results for inline comments if any failures occurred after the fetch window. Increase the timeout if you want to wait longer or run a @coderabbit review after the pipeline has finished.


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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@codecov

codecov Bot commented Jun 10, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 83.33333% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 73.76%. Comparing base (d180686) to head (c123c7c).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
...e/server/services/member-welcome-emails/service.js 80.00% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main   #28496   +/-   ##
=======================================
  Coverage   73.76%   73.76%           
=======================================
  Files        1541     1541           
  Lines      132279   132189   -90     
  Branches    15804    15816   +12     
=======================================
- Hits        97576    97513   -63     
+ Misses      33737    33709   -28     
- Partials      966      967    +1     
Flag Coverage Δ
admin-tests 54.67% <ø> (ø)
e2e-tests 73.76% <83.33%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@EvanHahn EvanHahn marked this pull request as ready for review June 10, 2026 18:54
@EvanHahn EvanHahn requested a review from troyciesco June 10, 2026 19:06

@troyciesco troyciesco left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think this might have user impact for people currently using welcome emails. I marked two spots but i'm not sure if there's more spots to address

Comment on lines -366 to -368
senderName: email.get('sender_name'),
senderEmail: email.get('sender_email'),
senderReplyTo: email.get('sender_reply_to')

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Image Image

I have custom stuff set in welcome_email_automated_emails (alpha, bravo, charlie) but with this change i'm getting the site fallbacks (Local Haunts, hey, hey2d).

This is with automations off - so i think we can't change this spot yet

Comment on lines -578 to -580
senderName: automatedEmail.get('sender_name'),
senderEmail: automatedEmail.get('sender_email'),
senderReplyTo: automatedEmail.get('sender_reply_to')

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think this change might also be an issue for those with welcome emails on currently

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants