Skip to content

Reader: show the body of a reposted comment instead of an empty quote - #51903

Merged
kraftbj merged 4 commits into
trunkfrom
reader-repost-comment-quote
Sep 9, 2026
Merged

kraftbj merged 4 commits into
trunkfrom
reader-repost-comment-quote

Conversation

@kraftbj

@kraftbj kraftbj commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Fixes #

Proposed changes

  • Build the body of a reposted quote from core/paragraph inner blocks instead of the deprecated value attribute, so it actually renders.

core/quote stopped rendering value in WordPress 6.1 (Gutenberg 13.8, WordPress/gutenberg#25892). All that survives of the attribute is a load-time migration, migrateToQuoteV2(), which reads it with a p selector — so anything that is not already inside a top-level <p> is dropped on sight.

The repost flow's text quote wrapped its content in <p> and so kept working. The comment quote passed comment_content straight through, and a comment that was plain text, or inline markup with no paragraph of its own, came out as an empty blockquote with the author still attached:

<!-- wp:quote -->
<blockquote class="wp-block-quote"><!-- wp:paragraph -->
<p></p>
<!-- /wp:paragraph --><cite>Some Author</cite></blockquote>
<!-- /wp:quote -->

This is not a regression with a window. reader-repost.js landed in March 2025, two and a half years after WordPress 6.1, so the feature has been broken since the day it shipped — and Jetpack requires WordPress 7.0, so no supported version renders value. The attribute is also explicitly on the way out: the block logs deprecated( 'Value attribute on the quote block', { since: '6.0', version: '6.5' } ).

Three details worth a reviewer's attention:

  • Loose content is wrapped, not discarded. A body that mixes bare text and paragraphs keeps all of itself, where the old migration kept only the paragraphs.
  • A top-level <blockquote> is flattened into a paragraph. It is the one tag the comment allowlist keeps that cannot live inside a <p>; wrapping it would serialize to <p><blockquote>, which the parser closes early on the way back in, stranding the text outside the block it belongs to. Flattening keeps the words and loses only the indentation.
  • A quote with an empty body is no longer emitted at all, rather than crediting someone for nothing. This also covers the case where sanitization empties the body.

Sanitization behavior is unchanged. createQuoteBody() runs on the output of the existing sanitizeCommentContent(), so the ordering is sanitize first, then split into paragraphs.

Related product discussion/links

  • n/a

Does this pull request change what data or activity we track or use?

No.

Testing instructions

You need a site where the block editor loads Jetpack's editor extensions (connected, or offline mode with the Blocks module active).

  1. Open this URL on that site, substituting your own host:

    /wp-admin/post-new.php?url=https%3A%2F%2Fexample.com%2Fp&title=T1&text=BODY1&comment_content=PLAINTEXTONLY&comment_author=AUTH1
    
  2. Before this change, the second quote renders as an empty blockquote attributed to AUTH1 — PLAINTEXTONLY appears nowhere in the editor or in the saved post. After, it renders as PLAINTEXTONLY with the AUTH1 citation.

  3. Confirm the body survives a save: save the draft, reload the editor, and check the quote still has its paragraph. Reading post_content directly (wp post get <id> --field=post_content) is a good extra check.

  4. Vary comment_content to cover the shapes the Reader can send. Each should render its text, and the last should produce no quote block at all:

    comment_content Expected quote body
    PLAINTEXTONLY one paragraph, PLAINTEXTONLY
    <a href="https://example.com/x">LINKONLY</a> one paragraph, link intact
    <p>FIRST</p><p>SECOND</p> two paragraphs
    <p>LINE1<br>LINE2</p> one paragraph, line break kept
    loose <em>text</em><p>PARA</p> two paragraphs, both halves kept
    <blockquote cite="https://example.com">bq text</blockquote> one paragraph, bq text
    no quote block
  5. Sanitization should behave exactly as it does on trunk. These should still be neutralized, now inside the paragraph rather than the value attribute:

    comment_content Expected
    <p>before</p><iframe srcdoc="<script>alert(1)</script>">x</iframe><p>after</p> three paragraphs, before / x / after; no iframe, no srcdoc
    <p><a href="javascript:alert(1)">click</a></p> <a>click</a> — href dropped
    <p>before</p><!-- /wp:quote --><!-- wp:html --><p>after</p> two paragraphs; no stray block delimiter
    <script>alert(1)</script> no quote block
  6. Unit tests: jetpack test js plugins/jetpack, or pnpm run test-extensions reader-repost from projects/plugins/jetpack.

core/quote stopped rendering its `value` attribute in WordPress 6.1. All that
survives of it is a load-time migration that reads the value with a `p`
selector, so a body that is not already inside a top-level `<p>` is dropped
outright.

The repost flow's text quote wrapped its content and so kept working; the
comment quote passed `comment_content` straight through, and a comment that
was plain text, or inline markup with no paragraph of its own, came out as an
empty blockquote with the author still attached.

Build the body as `core/paragraph` inner blocks instead. Runs of loose content
are wrapped rather than discarded, so a body that mixes the two keeps all of
itself, and a quote with nothing left to show is skipped rather than credited
to someone.
…t-quote

# Conflicts:
#	projects/plugins/jetpack/extensions/shared/reader-repost.js
#	projects/plugins/jetpack/extensions/shared/test/reader-repost.test.js
The merge resolution went in with hooks skipped, so ESLint never saw the two
helpers the merged test file added.
@kraftbj kraftbj added Bug When a feature is broken and / or not performing as intended [Status] Needs Review This PR is ready for review. [Focus] Blocks Issues related to the block editor, aka Gutenberg, and its extensions developed in Jetpack labels Sep 2, 2026
@kraftbj kraftbj self-assigned this Sep 2, 2026
@github-actions

github-actions Bot commented Sep 2, 2026 •

Copy link
Copy Markdown
Contributor

Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.

  • To test on WoA, go to the Plugins menu on a WoA dev site. Click on the "Upload" button and follow the upgrade flow to be able to upload, install, and activate the Jetpack Beta plugin. Once the plugin is active, go to Jetpack > Jetpack Beta, select your plugin (Jetpack), and enable the reader-repost-comment-quote branch.
  • To test on Simple, run the following command on your sandbox:
bin/jetpack-downloader test jetpack reader-repost-comment-quote

Interested in more tips and information?

  • In your local development environment, use the jetpack rsync command to sync your changes to a WoA dev blog.
  • Read more about our development workflow here: PCYsg-eg0-p2
  • Figure out when your changes will be shipped to customers here: PCYsg-eg5-p2

@github-actions github-actions Bot added [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ [Tests] Includes Tests labels Sep 2, 2026
@github-actions

github-actions Bot commented Sep 2, 2026 •

Copy link
Copy Markdown
Contributor

Thank you for your PR!

When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:

  • ✅ Include a description of your PR changes.
  • ✅ Add a "[Status]" label (In Progress, Needs Review, ...).
  • ✅ Add testing instructions.
  • ✅ Specify whether this PR includes any changes to data or privacy.
  • ✅ Add changelog entries to affected projects

This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖


Follow this PR Review Process:

  1. Ensure all required checks appearing at the bottom of this PR are passing.
  2. Make sure to test your changes on all platforms that it applies to. You're responsible for the quality of the code you ship.
  3. You can use GitHub's Reviewers functionality to request a review.
  4. When it's reviewed and merged, you will be pinged in Slack to deploy the changes to WordPress.com simple once the build is done.

If you have questions about anything, reach out in #jetpack-developers for guidance!


Jetpack plugin:

The Jetpack plugin has different release cadences depending on the platform:

  • WordPress.com Simple releases happen as soon as you deploy your changes after merging this PR (PCYsg-Jjm-p2).
  • WoA releases happen weekly.
  • Releases to self-hosted sites happen monthly:
    • Scheduled release: October 6, 2026

If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack.

@jp-launch-control

jp-launch-control Bot commented Sep 2, 2026 •

Copy link
Copy Markdown

Code Coverage Summary

Coverage changed in 1 file.

File Coverage Δ% Δ Uncovered
projects/plugins/jetpack/extensions/shared/reader-repost.js 80/83 (96.39%) 1.22% 0 💚

Full summary · PHP report · JS report

@kraftbj
kraftbj requested a review from jeherve September 8, 2026 18:51

@jeherve jeherve left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This tests well for me. 🚢

@jeherve jeherve added [Status] Ready to Merge Go ahead, you can push that green button! and removed [Status] Needs Review This PR is ready for review. labels Sep 9, 2026
@kraftbj
kraftbj merged commit 76fc710 into trunk Sep 9, 2026
82 checks passed
@kraftbj
kraftbj deleted the reader-repost-comment-quote branch September 9, 2026 14:55
@github-actions github-actions Bot added [Status] UI Changes Add this to PRs that change the UI so documentation can be updated. and removed [Status] Ready to Merge Go ahead, you can push that green button! labels Sep 9, 2026
@github-actions github-actions Bot added this to the jetpack/16.3 milestone Sep 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bug When a feature is broken and / or not performing as intended [Focus] Blocks Issues related to the block editor, aka Gutenberg, and its extensions developed in Jetpack [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ [Status] UI Changes Add this to PRs that change the UI so documentation can be updated. [Tests] Includes Tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants