Skip to content

Removed unused welcome email design fields from types#27521

Merged
troyciesco merged 3 commits intomainfrom
chris-ny-1204-clean-up-post_title_alignment-and-title_color-attributes
Apr 23, 2026
Merged

Removed unused welcome email design fields from types#27521
troyciesco merged 3 commits intomainfrom
chris-ny-1204-clean-up-post_title_alignment-and-title_color-attributes

Conversation

@cmraible
Copy link
Copy Markdown
Collaborator

@cmraible cmraible commented Apr 22, 2026

ref https://linear.app/ghost/issue/NY-1204/clean-up-post-title-alignment-and-title-color-attributes

This should have no user-facing impact.

These fields snuck into the original implementation, but ended up not being used for welcome emails. These are newsletter-only fields. Since the email-design component currently is only used by welcome emails, this cleans up the current types to match the current UI.

The admin-x-settings email-design stack is now only used by welcome emails, so removing newsletter-only fields keeps the types and helpers aligned with the actual UI.
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 22, 2026

Walkthrough

Removed the TitleAlignmentField component and its re-export. Deleted postTitleColor and its resolution logic from the email color model. Simplified types by removing EmailDesignPreviewSettings and merging to a single EmailDesignSettings type; DEFAULT_EMAIL_DESIGN no longer includes post_title_color or title_alignment. mapApiToDesignSettings now accepts EmailDesignSettings and filters results to keys in DEFAULT_EMAIL_DESIGN; buildAutomatedEmailDesignPayload applies the same whitelist. Unit tests were updated to disallow unexpected persisted fields (e.g., custom_future_field) from passing through.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 66.67% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
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.
Description check ✅ Passed The pull request description accurately describes the changes: removing unused newsletter-only fields (post_title_color and title_alignment) from the welcome email design component to align types with the actual UI.
Title check ✅ Passed The title accurately describes the main change: removing unused welcome email design fields (specifically post_title_color and title_alignment) from types and related components.

✏️ 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 chris-ny-1204-clean-up-post_title_alignment-and-title_color-attributes

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.

@cmraible cmraible marked this pull request as ready for review April 22, 2026 22:51
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
apps/admin-x-settings/test/unit/email-design/design-payload.test.ts (1)

7-32: ⚠️ Potential issue | 🟡 Minor

Seed the removed fields before asserting they are stripped.

These assertions pass even if the helpers leak post_title_color or title_alignment, because the fixtures do not contain those keys. Add legacy values so the tests exercise the cleanup path.

🧪 Proposed test fixture update
         const apiData = {
             id: '1',
             slug: 'default-automated-email',
             created_at: '2026-04-02T00:00:00.000Z',
             updated_at: '2026-04-02T00:00:00.000Z',
             header_image: null,
             show_header_icon: true,
             show_header_title: true,
             show_badge: true,
             footer_content: null,
-            ...DEFAULT_EMAIL_DESIGN
+            ...DEFAULT_EMAIL_DESIGN,
+            post_title_color: '#15171a',
+            title_alignment: 'center'
         };
@@
             designSettings: {
                 ...DEFAULT_EMAIL_DESIGN,
                 id: '1',
                 slug: 'default-automated-email',
                 created_at: '2026-04-02T00:00:00.000Z',
                 updated_at: '2026-04-02T00:00:00.000Z',
-                custom_future_field: '#abcdef'
+                custom_future_field: '#abcdef',
+                post_title_color: '#15171a',
+                title_alignment: 'center'
             } as unknown as typeof DEFAULT_EMAIL_DESIGN & {
                 id: string;
                 slug: string;
                 created_at: string;
                 updated_at: string;
                 custom_future_field: string;
+                post_title_color: string;
+                title_alignment: string;
             },

Also applies to: 47-88

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@apps/admin-x-settings/test/unit/email-design/design-payload.test.ts` around
lines 7 - 32, The test is asserting that legacy fields are removed but doesn't
seed those keys, so update the test fixture in
apps/admin-x-settings/test/unit/email-design/design-payload.test.ts by adding
legacy fields (e.g., post_title_color and title_alignment) to the apiData object
(alongside the already-present
id/slug/created_at/updated_at/header_image/show_header_icon/show_header_title/show_badge/footer_content
and DEFAULT_EMAIL_DESIGN) before calling mapApiToDesignSettings, and do the same
for the other test block (lines 47-88) so mapApiToDesignSettings is actually
exercised to strip those legacy properties.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In
`@apps/admin-x-settings/src/components/settings/membership/member-emails/welcome-email-customize-modal.tsx`:
- Around line 312-319: The code is still including legacy newsletter-only fields
(post_title_color, title_alignment) when building persistedDesign and when
filtering apiData; update the filtering used in both the function that builds
the initial design object and buildAutomatedEmailDesignPayload (where
persistedDesign is created) to also exclude 'post_title_color' and
'title_alignment' — either add those keys to the NON_DESIGN_FIELDS set or extend
the filter predicate to return false for those exact keys so they are not
hydrated or resent.

---

Outside diff comments:
In `@apps/admin-x-settings/test/unit/email-design/design-payload.test.ts`:
- Around line 7-32: The test is asserting that legacy fields are removed but
doesn't seed those keys, so update the test fixture in
apps/admin-x-settings/test/unit/email-design/design-payload.test.ts by adding
legacy fields (e.g., post_title_color and title_alignment) to the apiData object
(alongside the already-present
id/slug/created_at/updated_at/header_image/show_header_icon/show_header_title/show_badge/footer_content
and DEFAULT_EMAIL_DESIGN) before calling mapApiToDesignSettings, and do the same
for the other test block (lines 47-88) so mapApiToDesignSettings is actually
exercised to strip those legacy properties.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 1bd7e345-1439-4a1c-8371-e641b59df485

📥 Commits

Reviewing files that changed from the base of the PR and between 48069dc and bc754d3.

📒 Files selected for processing (6)
  • apps/admin-x-settings/src/components/settings/email-design/design-fields/index.ts
  • apps/admin-x-settings/src/components/settings/email-design/design-fields/title-alignment-field.tsx
  • apps/admin-x-settings/src/components/settings/email-design/design-utils.ts
  • apps/admin-x-settings/src/components/settings/email-design/types.ts
  • apps/admin-x-settings/src/components/settings/membership/member-emails/welcome-email-customize-modal.tsx
  • apps/admin-x-settings/test/unit/email-design/design-payload.test.ts
💤 Files with no reviewable changes (3)
  • apps/admin-x-settings/src/components/settings/email-design/design-fields/index.ts
  • apps/admin-x-settings/src/components/settings/email-design/design-fields/title-alignment-field.tsx
  • apps/admin-x-settings/src/components/settings/email-design/design-utils.ts

The removed newsletter-only field names were only being referenced in negative assertions, which kept legacy details in the test without improving coverage for the current welcome email design shape.
Using an allowlist based on the current welcome email design shape makes the helpers stricter and avoids carrying forward unexpected keys from future response or state changes.
@sonarqubecloud
Copy link
Copy Markdown

@cmraible cmraible requested a review from troyciesco April 22, 2026 23:37
@cmraible cmraible added the ok to merge for me You can merge this on my behalf if you want. label Apr 22, 2026
@cmraible cmraible changed the title Cleaned up unused welcome email design fields Removed unused welcome email design fields from types Apr 22, 2026
@troyciesco troyciesco merged commit 55c4d72 into main Apr 23, 2026
45 checks passed
@troyciesco troyciesco deleted the chris-ny-1204-clean-up-post_title_alignment-and-title_color-attributes branch April 23, 2026 13:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ok to merge for me You can merge this on my behalf if you want.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants