Skip to content

Tiled Gallery: source Photon-domain check from block editor settings filter#50426

Open
enejb wants to merge 3 commits into
trunkfrom
update/tiled-gallery-skip-photon-domain
Open

Tiled Gallery: source Photon-domain check from block editor settings filter#50426
enejb wants to merge 3 commits into
trunkfrom
update/tiled-gallery-skip-photon-domain

Conversation

@enejb

@enejb enejb commented Jul 10, 2026

Copy link
Copy Markdown
Member

Fixes # N/A

Proposed changes

Refactors how the Tiled Gallery block decides whether to bypass the external Photon (photon.js) domain and build files.wordpress.com-style URLs via photonWpcomImage instead.

  • Adds a block_editor_settings_all filter (Tiled_Gallery::add_block_editor_settings()) that exposes a skip_photon_domain boolean to the editor, sourced from the exact same signal as before: 'vip' === Jetpack_Plan::get()['product_slug'].
  • Replaces the previous isVIP() check — which read inline-script globals (jetpack_plan / Jetpack_Editor_Initial_State) via a fragile window load listener — with a single exported skipPhotonDomain() in utils/index.js that reads the setting through getSettings().
  • Removes the wp_localize_script( 'jetpack-gallery-settings', 'jetpack_plan', … ) call from render() and the window.addEventListener( 'load', … ) hack.
  • De-duplicates the check: the deprecated block versions (v2/v3/v4/v6) no longer define their own copies of isVIP() and now import the shared skipPhotonDomain().

No behavior change — the value delivered is identical to today; only the delivery mechanism (editor settings filter vs inline script) and naming change. The editor-settings filter is more reliable because the value is available synchronously when the block renders in the editor, where this code actually runs.

Related product discussion/links

  • N/A

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

No. The same plan signal is used; it is simply passed through the block editor settings filter instead of an inline script.

Testing instructions

  • On a non-VIP site (any normal Jetpack-connected site):
    • Add a Tiled Gallery block, insert several images, and switch across the Tiled mosaic, Circles, Square tiles, and Tiled columns styles. Images should photonize and render correctly with no console errors and no block-recovery prompt.
    • In the browser console, wp.data.select( 'core/block-editor' ).getSettings().skip_photon_domain should return false (a boolean, sourced from the new filter rather than the old inline script).
    • Save and reload the post to confirm the saved markup still validates (this exercises the deprecated-version code paths through the shared skipPhotonDomain()).
  • On a VIP site, skip_photon_domain should be true and image URLs should be built via the files.wordpress.com-style path, matching pre-existing behavior.

@enejb enejb added the [Status] Needs Review This PR is ready for review. label Jul 10, 2026
@enejb enejb self-assigned this Jul 10, 2026
@github-actions

github-actions Bot commented Jul 10, 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 update/tiled-gallery-skip-photon-domain branch.
  • To test on Simple, run the following command on your sandbox:
bin/jetpack-downloader test jetpack update/tiled-gallery-skip-photon-domain

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 [Block] Tiled Gallery [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ labels Jul 10, 2026
@github-actions

github-actions Bot commented Jul 10, 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:

No scheduled milestone found for this plugin.

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 Jul 10, 2026

Copy link
Copy Markdown

Code Coverage Summary

Coverage changed in 6 files. Only the first 5 are listed here.

File Coverage Δ% Δ Uncovered
projects/plugins/jetpack/extensions/blocks/tiled-gallery/tiled-gallery.php 23/429 (5.36%) -0.06% 5 💔
projects/plugins/jetpack/extensions/blocks/tiled-gallery/deprecated/v2/utils/index.js 0/38 (0.00%) 0.00% -2 💚
projects/plugins/jetpack/extensions/blocks/tiled-gallery/deprecated/v3/utils/index.js 0/38 (0.00%) 0.00% -2 💚
projects/plugins/jetpack/extensions/blocks/tiled-gallery/deprecated/v4/utils/index.js 0/40 (0.00%) 0.00% -2 💚
projects/plugins/jetpack/extensions/blocks/tiled-gallery/deprecated/v6/utils/index.js 0/40 (0.00%) 0.00% -2 💚

Full summary · PHP report · JS report

If appropriate, add one of these labels to override the failing coverage check: Covered by non-unit tests Use to ignore the Code coverage requirement check when E2Es or other non-unit tests cover the code Coverage tests to be added later Use to ignore the Code coverage requirement check when tests will be added in a follow-up PR I don't care about code coverage for this PR Use this label to ignore the check for insufficient code coveage.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Block] Tiled Gallery [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ [Status] Needs Review This PR is ready for review.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant