Skip to content

Comments: Sign in the comment editor's embed previews so embeds work in the Reader - #116348

Merged
arcangelini merged 2 commits into
trunkfrom
fix/comments-editor-signed-in-embeds
Nov 7, 2026
Merged

arcangelini merged 2 commits into
trunkfrom
fix/comments-editor-signed-in-embeds

Conversation

@arcangelini

Copy link
Copy Markdown
Member

Part of READ-775

Proposed Changes

Embeds never work in the Reader's comment editor. Every URL you embed turns into a plain link.

The Jetpack comment editor previews an embed by fetching its embedUrl without credentials, and turns any 4xx into a link. The Reader points it at /wpcom/v2/read/embed, which only answers signed-in readers on WordPress.com's own apps, so every lookup got a 401.

The editor can now take a fetchEmbed from its host (Automattic/jetpack#54664). The Reader passes one that calls the route through its own signed-in API client, so the route keeps its login and client checks. The editor reads the response status, so an error the route answered (404 for an untrusted URL, 429 for the rate limit) is handed back as a Response with that status. A request that never got a status throws, which the editor treats as worth retrying.

Until the Jetpack change reaches WordPress.com, the editor ignores fetchEmbed and behaves as it does today, so this can merge first.

Why are these changes being made?

  • A public preview route would work too, but it would let anyone use WordPress.com as an oEmbed proxy. Core's own proxy requires a signed-in user for the same reason.

Testing Instructions

  • Once the Jetpack change is on WordPress.com, open a post in /reader/conversations/inbox and start a comment.
  • Insert an Embed block (/embed, or /youtube with the Jetpack change) and paste a YouTube URL. The video preview shows instead of a link.
  • Paste a URL from a site that isn't an oEmbed provider. It turns into a link, as before.
  • yarn test-client client/blocks/comments/test/fetch-embed.test.ts

Pre-merge Checklist

  • Has the general commit checklist been followed? (PCYsg-hS-p2)
  • Have you written new tests for your changes?
  • Have you tested the feature in Simple (P9HQHe-k8-p2), Atomic (P9HQHe-jW-p2), and self-hosted Jetpack sites (PCYsg-g6b-p2)?
  • Have you checked for TypeScript, React or other console errors?
  • For UI changes, have you tested the affected components in dark mode?
  • Have you tested accessibility for your changes? Ensure the feature remains usable with various user agents (e.g., browsers), interfaces (e.g., keyboard navigation), and assistive technologies (e.g., screen readers) (PCYsg-S3g-p2).
  • Have you used memoizing on expensive computations? More info in Memoizing with create-selector and Using memoizing selectors and Our Approach to Data
  • Have we added the "[Status] String Freeze" label as soon as any new strings were ready for translation (p4TIVU-5Jq-p2)?
    • For UI changes, have we tested the change in various languages (for example, ES, PT, FR, or DE)? The length of text and words vary significantly between languages.
  • For changes affecting Jetpack: Have we added the "[Status] Needs Privacy Updates" label if this pull request changes what data or activity we track or use (p4TIVU-aUh-p2)?

Created with Claude Opus 5.5 in Claude Code.

@github-actions

github-actions Bot commented Nov 7, 2026 •

Copy link
Copy Markdown

🧐 Test on Calypso Live ⛅

Environment 🔗
WordPress.com Dashboard live link
WordPress.com (/reader) live link
Automattic for Agencies Dashboard live link
Automattic for Agencies live link
Jetpack Cloud live link

@github-actions

github-actions Bot commented Nov 7, 2026 •

Copy link
Copy Markdown

Here is how your PR affects size of JS and CSS bundles shipped to the user's browser:

Sections (~112 bytes added 📈 [gzipped])

Details
Name Parsed Gzip
home +486 B +0.0% +112 B +0.0%
reader +486 B +0.0% +112 B +0.0%

Sections contain code specific for a given set of routes. Is downloaded and parsed only when a particular route is navigated to.

Async-loaded Components (~112 bytes added 📈 [gzipped])

Details
Name Parsed Gzip
async-load-calypso-components-web-preview-component +486 B +0.1% +112 B +0.1%

React components that are loaded lazily, when a certain part of UI is displayed for the first time.

Legend

What is parsed and gzip size?

Parsed Size: Uncompressed size of the JS and CSS files. This much code needs to be parsed and stored in memory.
Gzip Size: Compressed size of the JS and CSS files. This much data needs to be downloaded over network.

@arcangelini
arcangelini marked this pull request as ready for review November 7, 2026 12:49
@arcangelini
arcangelini merged commit bcb6ef9 into trunk Nov 7, 2026
10 checks passed
@arcangelini
arcangelini deleted the fix/comments-editor-signed-in-embeds branch November 7, 2026 13:08
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