-
-
Notifications
You must be signed in to change notification settings - Fork 10.8k
Added element and typography newsletter setting columns #23347
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
## Walkthrough
This change introduces three new non-nullable string columns—`title_font_weight`, `link_style`, and `image_corners`—to the `newsletters` table, with associated default values and allowed value constraints defined in both the database migration and schema. The `Newsletter` model is updated to include default values for these new properties. The UI component for newsletter settings is updated to change the "Image corners" option from "Squircle" to "Rounded," modifying the key, label, tooltip, and value accordingly. The schema integrity test hash is updated to reflect these changes.
## Possibly related PRs
- TryGhost/Ghost#23190: Updates the "Image corners" control in the newsletter settings UI, directly related to the changes in button key and label for this control.
- TryGhost/Ghost#23322: Adds new styling-related columns to the `newsletters` table and updates newsletter model defaults, contextually related through similar schema and model modifications.
## Suggested labels
`migration`
## Suggested reviewers
- lsinger
- ErisDS Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
apps/admin-x-settings/src/components/settings/email/newsletters/NewsletterDetailModalPrototype.tsxOops! Something went wrong! :( ESLint: 8.57.1 ESLint couldn't find the plugin "eslint-plugin-react-hooks". (The package "eslint-plugin-react-hooks" was not found when loaded as a Node module from the directory "/apps/admin-x-settings".) It's likely that the plugin isn't installed correctly. Try reinstalling by running the following:
The plugin "eslint-plugin-react-hooks" was referenced from the config file in "apps/admin-x-settings/.eslintrc.cjs". If you still can't figure out the problem, please stop by https://eslint.org/chat/help to chat with the team. Note ⚡️ AI Code Reviews for VS Code, Cursor, WindsurfCodeRabbit now has a plugin for VS Code, Cursor and Windsurf. This brings AI code reviews directly in the code editor. Each commit is reviewed immediately, finding bugs before the PR is raised. Seamless context handoff to your AI code agent ensures that you can easily incorporate review feedback. Note ⚡️ Faster reviews with cachingCodeRabbit now supports caching for code and dependencies, helping speed up reviews. This means quicker feedback, reduced wait times, and a smoother review experience overall. Cached data is encrypted and stored securely. This feature will be automatically enabled for all accounts on May 16th. To opt out, configure ✨ Finishing Touches
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
It looks like this PR contains a migration 👀 General requirements
Schema changes
Data changes
|
ref https://linear.app/ghost/issue/PROD-1684 ref https://linear.app/ghost/issue/PROD-1729 ref https://linear.app/ghost/issue/PROD-1725 - adds newsletter columns ready for additional design settings to be implemented
2ed0a9e
to
a5e7f2a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (2)
ghost/core/core/server/data/migrations/versions/5.120/2025-05-14-20-00-15-add-newsletters-setting-columns.js (2)
3-22
: Migration looks good but consider adding database-level constraints for values.The migration adds three new columns to the newsletters table with appropriate defaults and types. The non-transactional approach is a good choice for adding columns to potentially large tables.
While the schema validation constraints (as mentioned in the AI summary) will enforce value restrictions at the application level, consider adding CHECK constraints at the database level for additional data integrity protection.
For example, you could add CHECK constraints to ensure the columns only accept valid values:
createAddColumnMigration('newsletters', 'title_font_weight', { type: 'string', maxlength: 50, nullable: false, defaultTo: 'bold' + // Add CHECK constraint: check (title_font_weight in ('normal', 'medium', 'semibold', 'bold')) }),
Note: The actual syntax for CHECK constraints would depend on your database system (MySQL, PostgreSQL, etc.).
1-22
: Consider adding migration tests to verify column creation.The migration appears well-structured, but it would be valuable to have tests that verify these columns are correctly created with their default values and constraints.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (2)
ghost/core/test/e2e-api/admin/__snapshots__/members.test.js.snap
is excluded by!**/*.snap
ghost/core/test/e2e-api/admin/__snapshots__/newsletters.test.js.snap
is excluded by!**/*.snap
📒 Files selected for processing (5)
apps/admin-x-settings/src/components/settings/email/newsletters/NewsletterDetailModalPrototype.tsx
(1 hunks)ghost/core/core/server/data/migrations/versions/5.120/2025-05-14-20-00-15-add-newsletters-setting-columns.js
(1 hunks)ghost/core/core/server/data/schema/schema.js
(1 hunks)ghost/core/core/server/models/newsletter.js
(1 hunks)ghost/core/test/unit/server/data/schema/integrity.test.js
(1 hunks)
✅ Files skipped from review due to trivial changes (1)
- ghost/core/core/server/models/newsletter.js
🚧 Files skipped from review as they are similar to previous changes (3)
- apps/admin-x-settings/src/components/settings/email/newsletters/NewsletterDetailModalPrototype.tsx
- ghost/core/test/unit/server/data/schema/integrity.test.js
- ghost/core/core/server/data/schema/schema.js
⏰ Context from checks skipped due to timeout of 90000ms (1)
- GitHub Check: Setup
🔇 Additional comments (2)
ghost/core/core/server/data/migrations/versions/5.120/2025-05-14-20-00-15-add-newsletters-setting-columns.js (2)
1-2
: Utility functions are appropriately imported for migration operations.The code imports necessary utility functions to help with non-transactional migrations and column creation, following Ghost's established patterns for database migrations.
16-21
: Verify UI component alignment for "image_corners" value changes.According to the AI summary, the UI was updated to change "squircle" to "rounded", yet the default value here is "square". Ensure the UI component correctly handles both potential values and that this change is documented for any existing integrations.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! 🚢
Please make sure to create an issue to rename the icons (icon: 'squircle',
in apps/admin-x-settings/src/components/settings/email/newsletters/NewsletterDetailModalPrototype.tsx
; and as you said on Slack the same is true for button corners). Let's keep this PR focused on getting the migrations shipped, though.
ref https://linear.app/ghost/issue/PROD-1684
ref https://linear.app/ghost/issue/PROD-1729
ref https://linear.app/ghost/issue/PROD-1725