-
Notifications
You must be signed in to change notification settings - Fork 798
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Blocks: Add Facebook and Instagram Embed block variations #17192
Conversation
Caution: This PR has changes that must be merged to WordPress.com |
E2E results is available here (for debugging purposes): https://jetpack-e2e-dashboard.herokuapp.com/pr-17192 This is an automated check which relies on |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It may be worth moving this to extensions/extended-blocks
, since we're extending a core block (vs. creating our own block).
See #17137 for an example.
Ah thanks, good point! |
|
I may be missing something here, but since the embed registration will also be removed from Core in 50861-core, won't we be creating issues on sites where Jetpack's Shortcodes module (where both Facebook and Instagram embeds are registered) is deactivated? On those sites, we'll show the 2 embed variations, but won't have the embed registration happening behind the scenes. This may happen on a lot of sites since the module is not activated by default. |
} | ||
|
||
addFilter( | ||
'blocks.registerBlockType', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could we use registerBlockVariation()
as default and use the filter method as a fallback?
That's a great point, thanks! Are we exposing the activation status of JP modules through a REST API endpoint already? (Can't remember off the top of my head 🤔 ) Otherwise I'll need to expose this some other way... |
f6216e6
to
815a23d
Compare
There are a few endpoints you could look at, and it may be worth creating a new shared utility in jetpack/_inc/lib/class.core-rest-api-endpoints.php Lines 274 to 310 in d8fe42c
Or maybe we could pass the list of modules and their status here: jetpack/class.jetpack-gutenberg.php Line 705 in 96065a5
|
Our blocks (and block variations) are only available if Jetpack is connected anyway.
9e4aea4
to
967c596
Compare
Rebased. |
This reverts commit 55c52e6.
Done in b69ecbc. |
There was a problem hiding this comment.
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. Merging.
…ons (#17192) Co-authored-by: Jeremy Herve <[email protected]>
Cherry-picked to I'll let you deal with the WordPress.com counterpart? |
"Successor" to D49605-code and 522-gh-wpcomsh. Once this is merged to JP, and the corresponding WP.com diff (D49756-code) is committed to WP.com, we can retire those changes.
Changes proposed in this Pull Request:
Quoting 522-gh-wpcomsh:
Jetpack product discussion
p7DVsv-9jU-p2#comment-31116
Does this pull request change what data or activity we track or use?
No.
Testing instructions:
Make sure you're testing on a WP install with Gutenberg 9.0 installed.
This diff is rather simple -- the crucial part is to make sure that we're actually not making any more requests to the legacy API endpoints for Instagram oEmbeds (https://api.instagram.com/oembed). We'll be testing that quite thoroughly in the following.
The Facebook embeds OTOH are largely unaffected, since they haven't been previewed in the editor before (instead, we've been displaying an
Embedded content from facebook.com can't be previewed in the editor.
message in the block). (Some discussion on whether that's the way it should be here: Automattic/wp-calypso#27701 (comment), but that's not really relevant to this PR.)0-sandbox.php
file todocker/mu-plugins/
, with the following contents:(change
YOURSANDBOX
to your sandbox' URL). Make sure to restart your JP install afterwards. For more information on this, see PCYsg-efV-p2 (Section "TheJETPACK__SANDBOX_DOMAIN
PHP Constant").on L40 of
wp-content/rest-api-plugins/endpoints/oembed-proxy.php
in your sandbox.(I can't post a diff here, since it would include an internal link.)
if
clause to make sure we're also using the new API for WP.com after Oct 24./wp-admin/admin.php?page=jetpack#/dashboard
, "Manage website connection"). Turn on Offline Mode. Reload the editor, and verify that the IG embed is gone from the inserter, while the FB one is still there.Conclusion from Testing Instructions
$auth_to_instagram = true
inwp-content/rest-api-plugins/endpoints/oembed-proxy.php
before Oct 24. (We know this much istrue
.)jetpack_instagram_fetch_embed
inmodules/shortcodes/instagram.php
accordingly.Proposed changelog entry for your changes:
Add Facebook and Instagram Embed block variations.
cc/ @Automattic/good-mountain @ebinnion @jeherve
Fixes Automattic/wp-calypso#45832