Repository navigation
feat: fork WP author-family blocks (post-author-name, post-author-biography, avatar) - #523
Conversation
…graphy, avatar) Forks the three upstream WP blocks that replace the deprecated core/post-author: post-author-name, post-author-biography, and avatar. Each block ships block.json with the artisanpack namespace + artisanpack/postPreview in usesContext, a createEntityPlaceholderEdit preview, a dynamic null save, bidirectional core/* ↔ artisanpack/* transforms, an inline-SVG inserter icon, and an upstream-state.json decision log. PostResolver dispatches all three new slugs to the existing resolveAuthor() since the resolved data shape is identical. Blade, React, and Vue renderer-parity coverage matches the post-author fork's "delegate to core partial" pattern; the renderer-parity manifest gains six entries (core/* and artisanpack/* per block). Now that the replacements ship, artisanpack/post-author restores supports.inserter: false to match upstream's deprecation. The entity-placeholder-query-preview test flips the post-author insertable assertion and adds six new tests for the author family's query-preview behavior. A dedicated author-family.test.ts mirrors the I5 entity-cluster contract suite. PostResolverArtisanPackTest adds four PHP tests covering both the artisanpack/* forks and their core/* counterparts. The avatar block keeps commentId in usesContext for forward-compat with the comments family fork (#519). Closes #518
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
🚧 Files skipped from review as they are similar to previous changes (3)
📝 WalkthroughWalkthroughThree author-related blocks (post-author-name, post-author-biography, avatar) are added as paired core/artisanpack fork variants across Blade, React, and Vue renderers. Each block includes Gutenberg metadata, editor placeholder behavior, server-side rendering, bidirectional transforms, and integration with the PostResolver backend system. Comprehensive tests validate block contracts and query-preview fallback behavior. ChangesAuthor Family Block Fork Implementation
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~22 minutes Possibly related issues
Possibly related PRs
Sequence Diagram(s)sequenceDiagram
participant Editor
participant EditPlaceholder as createEntityPlaceholderEdit
participant PostResolver as PostResolver.php
participant BladeTemplate as core Blade partial
Editor->>EditPlaceholder: show preview using _resolved* (author data)
Editor->>PostResolver: save/post traversal
PostResolver->>BladeTemplate: stamp and pass _resolved* attrs
BladeTemplate->>Editor: render sanitized HTML (img/links/text)
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 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 `@packages/visual-editor-renderer-react/src/blocks/core/postContext.tsx`:
- Around line 213-243: PostAuthorNameBlock and PostAuthorBiographyBlock
currently ignore attributes.textAlign, so add handling to read the alignment
(e.g., const textAlign = attrString(attributes.textAlign)) and include a
conditional class "has-text-align-{textAlign}" in the classes passed to
classList; update both PostAuthorNameBlock (ensuring the class is applied
whether rendering the <a> link branch or the plain <div>) and
PostAuthorBiographyBlock (applied to the <p>) so the editor's text alignment
(has-text-align-left/center/right/etc.) is emitted when attributes.textAlign is
present.
In `@tests/Unit/VisualEditor/Resources/PostResolverArtisanPackTest.php`:
- Around line 123-143: The test currently asserts literal values on core/*
stamped blocks which doesn't verify parity with artisanpack/*; update the test
to call PostResolver::stampBlock for the artisanpack variants (e.g.,
'artisanpack/post-author-name', 'artisanpack/post-author-biography',
'artisanpack/avatar') using the same fakeArtisanPackPost(), then assert that the
core/* attributes (_resolvedAuthorName, _resolvedAuthorBio,
_resolvedAuthorAvatar) are equal to the corresponding attributes on the
artisanpack/* stamped results (use the same PostResolver->stampBlock calls to
produce both sides) rather than comparing to hard-coded strings.
🪄 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: ba3fe402-be79-4a12-a6ca-4d51f6206a78
📒 Files selected for processing (38)
packages/renderer-parity.jsonpackages/visual-editor-renderer-blade/resources/views/blocks/artisanpack/avatar.blade.phppackages/visual-editor-renderer-blade/resources/views/blocks/artisanpack/post-author-biography.blade.phppackages/visual-editor-renderer-blade/resources/views/blocks/artisanpack/post-author-name.blade.phppackages/visual-editor-renderer-blade/resources/views/blocks/core/avatar.blade.phppackages/visual-editor-renderer-blade/resources/views/blocks/core/post-author-biography.blade.phppackages/visual-editor-renderer-blade/resources/views/blocks/core/post-author-name.blade.phppackages/visual-editor-renderer-react/src/blocks/core/postContext.tsxpackages/visual-editor-renderer-react/src/blocks/registerCoreBlocks.tspackages/visual-editor-renderer-vue/src/blocks/core/postContext.tspackages/visual-editor-renderer-vue/src/blocks/registerCoreBlocks.tsresources/js/visual-editor/blocks/__tests__/author-family.test.tsresources/js/visual-editor/blocks/_shared/__tests__/entity-placeholder-query-preview.test.tsxresources/js/visual-editor/blocks/avatar/block.jsonresources/js/visual-editor/blocks/avatar/edit.tsxresources/js/visual-editor/blocks/avatar/index.tsresources/js/visual-editor/blocks/avatar/inserter-icon.tsxresources/js/visual-editor/blocks/avatar/save.tsxresources/js/visual-editor/blocks/avatar/transforms.tsresources/js/visual-editor/blocks/avatar/upstream-state.jsonresources/js/visual-editor/blocks/post-author-biography/block.jsonresources/js/visual-editor/blocks/post-author-biography/edit.tsxresources/js/visual-editor/blocks/post-author-biography/index.tsresources/js/visual-editor/blocks/post-author-biography/inserter-icon.tsxresources/js/visual-editor/blocks/post-author-biography/save.tsxresources/js/visual-editor/blocks/post-author-biography/transforms.tsresources/js/visual-editor/blocks/post-author-biography/upstream-state.jsonresources/js/visual-editor/blocks/post-author-name/block.jsonresources/js/visual-editor/blocks/post-author-name/edit.tsxresources/js/visual-editor/blocks/post-author-name/index.tsresources/js/visual-editor/blocks/post-author-name/inserter-icon.tsxresources/js/visual-editor/blocks/post-author-name/save.tsxresources/js/visual-editor/blocks/post-author-name/transforms.tsresources/js/visual-editor/blocks/post-author-name/upstream-state.jsonresources/js/visual-editor/blocks/post-author/block.jsonresources/js/visual-editor/blocks/post-author/upstream-state.jsonsrc/Resources/PostResolver.phptests/Unit/VisualEditor/Resources/PostResolverArtisanPackTest.php
- React + Vue PostAuthorNameBlock / PostAuthorBiographyBlock now read
attributes.textAlign and emit has-text-align-{align} classes,
matching the existing PostTitle / PostDate / PostExcerpt pattern.
Both blocks declare typography.textAlign: true in block.json but the
renderers were dropping the alignment on save. Blade is unaffected
because BlockSupports::wrapperAttrs already handles textAlign for
every wrapper.
- PostResolverArtisanPackTest's core-vs-artisanpack parity case now
asserts the resolved attribute bags are equal, so a one-sided
regression on either namespace trips the test instead of passing
against the static literal baseline.
Description
Forks the three upstream WP blocks that replace the deprecated
core/post-author—post-author-name,post-author-biography, andavatar— into theartisanpack/*namespace, following the established I5 entity-cluster fork pattern. Each block carries a context-aware editor preview (createEntityPlaceholderEdit), bidirectionalcore/* ↔ artisanpack/*transforms, server-side_resolved*stamping viaPostResolver, and three-renderer parity coverage (Blade + React + Vue). Now that all three replacements ship,artisanpack/post-authorrestoressupports.inserter: falseto match upstream's deprecation contract.Closes: #518
Type of Change
Related Issue
Issue: #518 (parent meta: #506)
Motivation and Context
Closes the parity gap between upstream WP's
themeblock category and the visual-editor fork: previously the fork only shippedcore/post-author, which upstream itself hides becausepost-author-name+post-author-biography+avatarare the recommended replacements. Authors copying a Gutenberg pattern with any of these blocks saw "Unknown block" failures. This PR ships the first family from the meta-issue (#506) — the smallest scope sub-issue, which also unlocks the inserter-hide for the deprecated post-author block.Changes Made
Three new forked blocks under
resources/js/visual-editor/blocks/:post-author-name/— text kind, reads_resolvedAuthorName/_resolvedAuthorUrlpost-author-biography/— html kind, reads_resolvedAuthorBioavatar/— image kind, reads_resolvedAuthorAvatar(URL) and_resolvedAuthorName(alt). RetainscommentIdinusesContextfor forward-compat with the comments family fork (Fork WP theme blocks · Comments family (comments wrapper, comment-template, post-comments-*, comment-*) #519)Each block ships
block.json(artisanpack namespace,artisanpack/postPreviewinusesContext),edit.tsx(viacreateEntityPlaceholderEdit),save.tsxreturningnull,transforms.ts(bidirectional withcore/*), inline-SVGinserter-icon.tsx, and anupstream-state.jsondecision log.Server-side resolution —
src/Resources/PostResolver.phpadds the six new block names (core/*+artisanpack/*) toSUPPORTED_BLOCKSand dispatches all three slugs to the existingresolveAuthor()since the resolved data shape is identical.Three-renderer parity:
core/{name}.blade.php+artisanpack/{name}.blade.phpdelegating via@include).core/postContext.tsx+ 6 new entries inregisterCoreBlocks.ts.packages/renderer-parity.jsongains 6 entries;npm run verify:parityis green.Deprecation cutover:
artisanpack/post-author/block.jsonrestoressupports.inserter: falseto match upstream now that the replacements ship.upstream-state.jsonknownDivergences is trimmed accordingly.How Has This Been Tested?
Testing Environment:
release/1.0)Tests Performed:
npm run test— full Vitest suite: 1702/1702 tests pass (including the 13 new author-family contract tests and 6 new query-preview tests)composer test— full Pest suite: 809/809 tests pass (including 4 new PostResolver tests covering both artisanpack/* forks and their core/* counterparts)npm run verify:parity— renderer parity check: 95/95 blocks registered across blade/react/vuenpm run upstream-diff— all forks in sync with their pinned upstreamnpm run build— TypeScript build green/admin/site-editor, dropped the three new blocks into a template Query Loop. Editor preview correctly stamps the resolved post's author name and avatar (host-side User model neededname/avatar_urlaccessors for the bridge — host wiring, out of scope for this PR). Deprecatedartisanpack/post-authorno longer appears in the inserter. Bidirectional block transforms round-trip losslessly.Accessibility Tests Run
altattribute pulled from_resolvedAuthorName; missing alt falls back to empty per upstreamcore/avatarsemantics)Details: The new blocks emit the same Gutenberg-shaped markup as their upstream counterparts; no new interactive surfaces or focus management was introduced.
Tests Added
Test details:
resources/js/visual-editor/blocks/__tests__/author-family.test.ts(new) — 13 contract tests covering block.json namespace + textdomain +artisanpack/postPreviewinusesContext, dynamic null save, bidirectional transforms, and avatar'scommentIdforward-compatresources/js/visual-editor/blocks/_shared/__tests__/entity-placeholder-query-preview.test.tsx(extended) — 6 new tests for the three blocks' query-preview behavior plus a flipped assertion forartisanpack/post-authornow being inserter-hiddentests/Unit/VisualEditor/Resources/PostResolverArtisanPackTest.php(extended) — 4 new tests covering server-side resolution for the three new artisanpack/* blocks and their core/* counterpartsDocumentation
upstream-state.jsondecision logs)Documentation details: Each new block's
upstream-state.jsonrecords the upstream pinned version (9.43.0), file-by-file divergence status, and known divergences from upstream — consumed byscripts/upstream-diff.mjsfor drift detection.Screenshots
N/A — the new blocks render byte-equivalent to their upstream counterparts. Visual diff was confirmed during manual testing in keystone-cms.
Pre-Submission Checklist
Summary by CodeRabbit
New Features
Chores
Tests