fix(plugins): expose slug and status on ContentItem#460
Open
all3f0r1 wants to merge 1 commit intoemdash-cms:mainfrom
Open
fix(plugins): expose slug and status on ContentItem#460all3f0r1 wants to merge 1 commit intoemdash-cms:mainfrom
all3f0r1 wants to merge 1 commit intoemdash-cms:mainfrom
Conversation
The plugin content API (`ctx.content.get()` / `ctx.content.list()`) was returning `ContentItem` without the `slug` or `status` fields, even though the underlying row has both. Migration, SEO, and any other plugin that needs to match external data to content by slug had to fall back to fragile title matching. Add `slug` (nullable) and `status` to `ContentItem` and populate them in the read and write adapters. Closes emdash-cms#373
🦋 Changeset detectedLatest commit: 038fa72 The changes in this PR will be included in the next version bump. This PR includes changesets to release 9 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Contributor
Author
|
@ascorbic please let me know when you want me to rebase. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
The plugin content API (
ctx.content.get()/ctx.content.list()) returnedContentItemwithout theslugorstatusfields, even though the underlying row has both and the REST API already surfaces them at the top level. This made it surprisingly painful to match external data to EmDash content by slug — migration plugins, SEO plugins, and WXR importers had to fall back to fragile title matching.This PR adds
slug(nullable — a freshly created draft may not have one yet) andstatustoContentItem, and populates them in both the read-only and read/write content access adapters inpackages/core/src/plugins/context.ts. The data was already on the repository-levelContentItem; the plugin adapter was just dropping it on the floor.Closes #373
Type of change
Checklist
pnpm typecheckpassespnpm --silent lint:json | jq '.diagnostics | length'returns 0 new diagnostics (only the pre-existingpackages/admin/src/router.tsxwarning remains, unrelated to this change)pnpm testpasses (targeted:packages/corecapabilities integration suite — 54 tests pass, including the new cases covering slug/status onget(),list(), andcreate())pnpm formathas been runAI-generated code disclosure
Screenshots / test output
✓ tests/integration/plugins/capabilities.test.ts (54 tests) 2660ms
Test Files 1 passed (1)
Tests 54 passed (54)
New test cases added:
slugandstatuson items returned fromget()slugandstatuson items returned fromlist()can create new contentto assertslugandstatusare present on the created item