Tiled Gallery: source Photon-domain check from block editor settings filter#50426
Tiled Gallery: source Photon-domain check from block editor settings filter#50426enejb wants to merge 3 commits into
Conversation
|
Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.
Interested in more tips and information?
|
|
Thank you for your PR! When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:
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:
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. |
Code Coverage SummaryCoverage changed in 6 files. Only the first 5 are listed here.
Full summary · PHP report · JS report If appropriate, add one of these labels to override the failing coverage check:
Covered by non-unit tests
|
… core/block-editor
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 viaphotonWpcomImageinstead.block_editor_settings_allfilter (Tiled_Gallery::add_block_editor_settings()) that exposes askip_photon_domainboolean to the editor, sourced from the exact same signal as before:'vip' === Jetpack_Plan::get()['product_slug'].isVIP()check — which read inline-script globals (jetpack_plan/Jetpack_Editor_Initial_State) via a fragilewindowloadlistener — with a single exportedskipPhotonDomain()inutils/index.jsthat reads the setting throughgetSettings().wp_localize_script( 'jetpack-gallery-settings', 'jetpack_plan', … )call fromrender()and thewindow.addEventListener( 'load', … )hack.isVIP()and now import the sharedskipPhotonDomain().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
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
wp.data.select( 'core/block-editor' ).getSettings().skip_photon_domainshould returnfalse(a boolean, sourced from the new filter rather than the old inline script).skipPhotonDomain()).skip_photon_domainshould betrueand image URLs should be built via thefiles.wordpress.com-style path, matching pre-existing behavior.