Skip to content
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

Merged
merged 6 commits into from
Aug 17, 2023
Merged

Add production blocks metadata #32497

merged 6 commits into from
Aug 17, 2023

Conversation

andrii-lysenko
Copy link
Contributor

@andrii-lysenko andrii-lysenko commented Aug 15, 2023

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:

  • Have you written new tests for your changes, if applicable?
  • Have you checked the E2E test CI results, and verified that your changes do not break them?
  • Have you tested your changes on WordPress.com, if applicable (if so, you'll see a generated comment below with a script to run)?

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.

@github-actions
Copy link
Contributor

github-actions bot commented Aug 15, 2023

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 WordPress.com Simple 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 > Jetpack and enable the add/prod-blocks-metadata branch.

  • To test on Simple, run the following command on your sandbox:

    bin/jetpack-downloader test jetpack add/prod-blocks-metadata
    

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
Copy link
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.
  • ✅ All commits were linted before commit.
  • ✅ Add a "[Status]" label (In Progress, Needs Team 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 🤖


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.
Then, add the "[Status] Needs Team Review" label and ask someone from your team review the code. Once reviewed, it can then be merged.
If you need an extra review from someone familiar with the codebase, you can update the labels from "[Status] Needs Team Review" to "[Status] Needs Review", and in that case Jetpack Approvers will do a final review of your PR.


Jetpack plugin:

  • Next scheduled release: August 23, 2023.
  • Scheduled code freeze: August 21, 2023.

@andrii-lysenko andrii-lysenko marked this pull request as ready for review August 16, 2023 17:50
Copy link
Member

@jeherve jeherve left a 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 @@
{
Copy link
Member

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?

Copy link
Member

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.

Copy link
Member

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.

Copy link
Member

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.

Copy link
Member

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.

Copy link
Member

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 @@
{
Copy link
Member

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.

Copy link
Member

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.

@kraftbj kraftbj merged commit 9e12ebd into trunk Aug 17, 2023
@kraftbj kraftbj deleted the add/prod-blocks-metadata branch August 17, 2023 02:37
@github-actions github-actions bot added this to the jetpack/12.5 milestone Aug 17, 2023
haqadn pushed a commit that referenced this pull request Aug 17, 2023
* add part of blocks metadata

* add: changelog

* add additional blocks

* add suggested changes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Status: Done
Development

Successfully merging this pull request may close these issues.

5 participants