-
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
Related Posts Block: make the block available even when the module is disabled #32930
Conversation
Whether the module is active or not, we'll register the Related Posts block.
- The placeholder includes a button inviting you to activate the module. - While the module status loads, we display placeholder block contents.
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:
|
- Include module status check - Move to function component - Mock additional functions
Modules behave differently there
projects/plugins/jetpack/extensions/blocks/related-posts/test/edit.js
Outdated
Show resolved
Hide resolved
One can also disable Related Posts (while the module is active) via a toggle in Settings > Reading in Calypso. Let's add: - 2 new endpoints to fetch and update that info. - a new hook to handle this new status info in the block editor. - hook the new hook into the Related Posts' block in the editor.
Seems to work in self-hosted. On Simple, when adding the block with the feature enabled I get a flash of "You'll need to activate the Related Posts feature" before it switches over to displaying the block. I think your new
useModuleStatus .
|
ah that's a good point, thank you! I just committed 4fda28d to help with that. |
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.
Seems to work.
On several simple sites, I am seeing the prompt to activate the related posts block in the editor, even when the setting in yoursimplesite.com/wp-admin/options-reading.php for related posts is enabled. Clicking the activate option in the editor does nothing. A user reported this across three sites, and I can replicate on a test site. All previously added related posts blocks are no longer working on their site. I'm not sure if this is related to this, but it seems possible @jeherve Ticket: 7012332-zd-a8c |
Support References This comment is automatically generated. Please do not edit it.
|
@sajmes Thanks for letting me know. Could you try on your test sites and on the customer's site again? It should work now. |
@jeherve - I checked this and it appears that for existing related post blocks to work, the block needs to be activated from any post on the site. On one of the user's sites, I activated this and the block is displaying related posts on their existing posts. On their other site, I did not click the activate option on the related posts block, and the site is still not displaying related posts on posts where that block was previously added. Can you replicate that? Is this something we can automatically activate for existing blocks if so? |
As discussed in Slack, I'm thinking that this may happen for all the folks who had added Related Posts blocks to their site without fully activating the feature in Settings > Reading. To fix this issue, one would have to do the following:
That should hopefully fix things. |
@renata-franco No, this isn't related. You'll see this grayed out block whenever the block has already been inserted elsewhere on the page, and when the block has a restriction of one block per page. |
Thank you, Jeremy! Fixed. |
Fixes #11861
Proposed changes:
This PR changes the behavior of the Related Posts block when the feature is not available.
Current behavior
On WordPress.com Simple
On simple, you're able to disable the Related Posts feature via the
enabled
option of therelatedposts
Jetpack option. This setting is available under Settings > Reading:https://yourdotcomsimplesite.com/wp-admin/options-reading.php
When this happens, the block is still available in the editor but will not work properly, as outlined in #11861.
On self-hosted sites
On self-hosted sites (WoA and Jetpack), you can disable the Related Posts module, under Jetpack > Settings > Traffic
In this scenario, the block isn't registered in the editor.
Future behavior
On both environments, the Related Posts block will remain registered and available. When the feature or the module will be disabled:
Other information:
Jetpack product discussion
Does this pull request change what data or activity we track or use?
Testing instructions:
This needs to be tested on simple and on self-hosted. To test this, it's best if you use a site with a lot of existing content, so related posts can be displayed.
On WordPress.com Simple
On self-hosted