Automattic / Automattic/jetpack
Paywall block: switch to standard block editor type check
- Dominant language
- PHP
- Stars
- 1.8k
- Forks
- 898
- Avg merge
- 1d 18h
- Merged PRs (30d)
- 774
Description
### Impacted plugin
Jetpack
### What
Refactor block's unregistration to backend.
### How
In Paywall block we check for post type to decide if to _unregister_ the block after it has already been registered(added in https://github.com/Automattic/jetpack/pull/32190). The block should not be available in templates, pages, etc.
https://github.com/Automattic/jetpack/blob/a59af2aba8d972b14fe87e8a858988474c4c074b/projects/plugins/jetpack/extensions/blocks/paywall/editor.js#L6-L18
Once loading blocks via `block.json` is supported, we can switch to more standards way of not registering a block based on if the post type is `post`, and do it in PHP instead, see:
https://developer.wordpress.org/reference/hooks/allowed_block_types_all/#comment-5624
https://developer.wordpress.org/block-editor/reference-guides/filters/block-filters/#allowed_block_types_all
Original slack convo p1690892655610999-slack-C052XEUUBL4
Contributor guide
Research direction
Start with projects/plugins/jetpack/extensions/blocks/paywall/editor.js and the documented allowed_block_types_all filter references to understand the current client-side unregistration and the intended backend entry point. Done means the Paywall block is available for posts but not templates, pages, or other post types, with the relevant checks passing.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, php, wordpress
- Domain
- backend
- Issue type
- Refactor
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100