Skip to content

Moved settings limit dialogs to Shade - #29562

Merged
9larsons merged 1 commit into
mainfrom
codex/admin-settings-shade-limit-modal
Jul 23, 2026
Merged

9larsons merged 1 commit into
mainfrom
codex/admin-settings-shade-limit-modal

Conversation

@9larsons

Copy link
Copy Markdown
Contributor

What changed

  • moved the settings LimitModal implementation out of admin-x-design-system
  • rebuilt it on the Settings-local Shade confirmation dialog
  • migrated all settings limit prompts to the local component
  • preserved HTML limit messages and made prompt content use the full modal content width with normal wrapping
  • added focused coverage for defaults, HTML prompts, sizing, and the upgrade action

Why

Limit prompts were one of the remaining Settings dependencies on the legacy admin-x-design-system modal layer. Keeping the wrapper local lets Settings preserve its host-limit behavior while using the Shade modal foundation.

Validation

  • pnpm --dir apps/admin-x-settings lint
  • pnpm --dir apps/admin-x-design-system lint
  • pnpm --dir apps/admin-x-settings test — 24 files / 217 tests
  • focused LimitModal test
  • clean admin-x-design-system build without the legacy export
  • direct apps/admin build

no ref

The settings app can now own its upgrade prompts without retaining a dependency on the legacy design-system modal implementation.
@coderabbitai

coderabbitai Bot commented Jul 23, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Walkthrough

LimitModal exports were removed from the design-system barrel and consumers now import the component locally from admin-x-settings. LimitModal was refactored to render through ConfirmationModalContent, which gained an optional configurable test ID. The LimitModal Storybook story was removed, and a unit test was added covering prompt HTML, upgrade interaction, modal presence, and cleanup.

Possibly related PRs

  • TryGhost/Ghost#29561: Adds the Shade-based ConfirmationModalContent component used by this LimitModal refactor.

Suggested reviewers: cmraible

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: moving settings limit dialogs to Shade.
Description check ✅ Passed The description matches the changeset and accurately describes the local LimitModal migration and added coverage.
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.
✨ 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 codex/admin-settings-shade-limit-modal

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.

@9larsons
9larsons marked this pull request as ready for review July 23, 2026 18:21
@nx-cloud

nx-cloud Bot commented Jul 23, 2026 •

Copy link
Copy Markdown

🤖 Nx Cloud AI Fix

Ensure the fix-ci command is configured to always run in your CI pipeline to get automatic fixes in future runs. For more information, please see https://nx.dev/ci/features/self-healing-ci


View your CI Pipeline Execution ↗ for commit c457971

Command Status Duration Result
nx run @tryghost/admin:test:acceptance ✅ Succeeded 6m 7s View ↗
nx run-many -t test:unit -p @tryghost/admin-x-d... ✅ Succeeded 2m 26s View ↗
nx run ghost-monorepo:lint:boundaries ✅ Succeeded 22s View ↗
nx run-many -t lint -p @tryghost/admin-x-design... ✅ Succeeded 1m 13s View ↗
nx run @tryghost/admin:build ✅ Succeeded 17s View ↗
nx run-many --target=build --projects=tag:publi... ✅ Succeeded 1s View ↗

💡 Verify your cache is correct by running tasks in a sandbox. Read docs ↗


☁️ Nx Cloud last updated this comment at 2026-07-23 18:28:36 UTC

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@apps/admin-x-settings/src/components/limit-modal.tsx`:
- Around line 23-35: Update the promptContent handling in the limit modal to
sanitize string prompts containing HTML with an explicit safe allowlist before
passing them to dangerouslySetInnerHTML. Keep non-HTML strings and existing
React-node prompts on the normal rendering path, and ensure the sanitized
value—not the raw prompt—is injected.
🪄 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 Plus

Run ID: b849da49-1abe-4771-b544-27bdd09517a8

📥 Commits

Reviewing files that changed from the base of the PR and between fd7d8dc and c457971.

📒 Files selected for processing (15)
  • apps/admin-x-design-system/src/global/modal/limit-modal.stories.tsx
  • apps/admin-x-design-system/src/index.ts
  • apps/admin-x-settings/src/components/confirmation-modal.tsx
  • apps/admin-x-settings/src/components/limit-modal.tsx
  • apps/admin-x-settings/src/components/settings/advanced/integrations/add-integration-modal.tsx
  • apps/admin-x-settings/src/components/settings/email/newsletters/add-newsletter-modal.tsx
  • apps/admin-x-settings/src/components/settings/email/newsletters/newsletter-detail-modal.tsx
  • apps/admin-x-settings/src/components/settings/general/user-detail-modal.tsx
  • apps/admin-x-settings/src/components/settings/membership/stripe/stripe-connect-modal.tsx
  • apps/admin-x-settings/src/components/settings/membership/tiers.tsx
  • apps/admin-x-settings/src/components/settings/site/change-theme.tsx
  • apps/admin-x-settings/src/components/settings/site/design-and-theme-modal.tsx
  • apps/admin-x-settings/src/components/settings/site/theme-modal.tsx
  • apps/admin-x-settings/src/components/settings/site/theme/advanced-theme-settings.tsx
  • apps/admin-x-settings/test/unit/components/limit-modal.test.tsx
💤 Files with no reviewable changes (2)
  • apps/admin-x-design-system/src/index.ts
  • apps/admin-x-design-system/src/global/modal/limit-modal.stories.tsx

Comment on lines +23 to +35
const promptContent = typeof prompt === 'string' && prompt.includes('<') ? (
<div dangerouslySetInnerHTML={{__html: prompt}} />
) : prompt;

return (
<Modal
backDropClick={false}
<ConfirmationModalContent
formSheet={formSheet}
okLabel={okLabel}
okVariant='default'
prompt={<div className='w-full'>{promptContent}</div>}
testId='limit-modal'
title={title}
width={540}
onOk={onOk}
>
<div className='py-4 leading-9 text-pretty'>
{typeof prompt === 'string' && prompt.includes('<') ? (
<div dangerouslySetInnerHTML={{__html: prompt}} />
) : (
prompt
)}
</div>
</Modal>
/>

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.

🔒 Security & Privacy | 🟠 Major | ⚡ Quick win

Sanitize the HTML prompt before injecting it.

HostLimitError.message is passed into this component by callers, and any untrusted markup is sent directly to dangerouslySetInnerHTML, bypassing React escaping. Sanitize with an allowlist at this boundary, or only render trusted React nodes.

Static analysis identifies this raw HTML injection sink.

🧰 Tools
🪛 ast-grep (0.44.1)

[warning] 23-23: Usage of dangerouslySetInnerHTML detected. This bypasses React's built-in XSS protection. Always sanitize HTML content using libraries like DOMPurify before injecting it into the DOM to prevent XSS attacks.
Context: dangerouslySetInnerHTML
Note: [CWE-79] Improper Neutralization of Input During Web Page Generation

(react-unsafe-html-injection)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@apps/admin-x-settings/src/components/limit-modal.tsx` around lines 23 - 35,
Update the promptContent handling in the limit modal to sanitize string prompts
containing HTML with an explicit safe allowlist before passing them to
dangerouslySetInnerHTML. Keep non-HTML strings and existing React-node prompts
on the normal rendering path, and ensure the sanitized value—not the raw
prompt—is injected.

Source: Linters/SAST tools

@github-actions

Copy link
Copy Markdown
Contributor

E2E Tests Failed

To view the Playwright test report locally, run:

REPORT_DIR=$(mktemp -d) && gh run download 30033282027 -n playwright-report -D "$REPORT_DIR" && npx playwright show-report "$REPORT_DIR"

@9larsons
9larsons merged commit 3c56efa into main Jul 23, 2026
68 of 81 checks passed
@9larsons
9larsons deleted the codex/admin-settings-shade-limit-modal branch July 23, 2026 18:41
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.

1 participant