-
Notifications
You must be signed in to change notification settings - Fork 799
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
Add production blocks metadata #32497
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 🤖 The e2e test report can be found here. Please note that it can take a few minutes after the e2e tests checks are complete for the report to be available. Once your PR is ready for review, check one last time that all required checks (other than "Required review") appearing at the bottom of this PR are passing or skipped. Jetpack plugin:
|
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.
I left a few comments below.
Overall, it seems there is a mix of spaces and tabs in the different .json files. Should we stick to just tabs?
@@ -0,0 +1,21 @@ | |||
{ |
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.
I don't know if we need this one, since that's just a parent block for the Payments button, Donations, and Paid content blocks?
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.
jetpack/payments-intro
is a block like any other: it's registered with register_block_type
, can be inserted from the inserter, and is serialized as <!-- wp:jetpack/payments-intro /-->
. What is special about is that it's meant to be a temporary placeholder, to be quickly replaced by one of the "real" payment blocks. But that's just semantics, formally it's a block.
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.
Right, but I'm not sure it's one that we must publicize on W.org, given that we already publicize the "real" payment blocks. It may create more confusion than anything else.
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.
Having a block.json
file should be useful and preferred for all blocks. For example, they are then properly visible in the /block-types
REST endpoint. If we don't want to publicize them on W.org, maybe there is a block.json
flag for that? @gziolo will know.
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.
You don't need block.json
to expose the block in the REST endpoint. All you need is to register it with register_block_type
so it's available in the block type registry.
I don't know precisely how W.org scans the code of the plugin when looking for block types. I bet though, that when you alias the function with something else, it won't list it.
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.
All you need is to register it with
register_block_type
so it's available in the block type registry.
Jetpack currently doesn't do server-side block registration with the block.json
. The subset of fields that it passes to register_block_type
is a very small subset, and it's duplicated. So, the info available in the REST endpoint will be very limited. It would be a nice follow-up to improve this.
I don't know precisely how W.org scans the code of the plugin when looking for block types.
That would be nice to know, especially if there is any "opt-out from public registry listing" flag. It would be very useful for cases like this one.
@@ -0,0 +1,12 @@ | |||
{ |
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 is more of a plugin than a block, I think we could leave it out.
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 is right, social-previews
registers only a plugin (adding stuff to sidebar and the pre-publish panel), there's no block at all. But removing payments-intro/block.json
was a mistake.
* add part of blocks metadata * add: changelog * add additional blocks * add suggested changes
See #32408
Proposed changes:
This PR adds block json metadata files to production blocks in order to make them visible through w.org.
Other information:
Jetpack product discussion
pedMtX-RS-p2
Does this pull request change what data or activity we track or use?
No
Testing instructions:
Review the files content.