-
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
Search: avoid registering the widget when the module is not active #21588
Conversation
Fixes #21587 The `Jetpack_Search` class will not be loaded if the Search module is not active. So let's not register the widget when the feature is not available.
Caution: This PR has changes that must be merged to WordPress.com |
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:
|
FYI, this was intentional for classic search so that the user could activate search by just adding the widget. But I think with instant search it is no longer needed. |
Hi @jeherve Thanks for the PR. The logic look fine - but when I tested on this branch and master, both worked. That is to say, when I disabled search module, on both branches the |
Hm, that is an odd one. I've only tested this using the test site in p8oabR-K9-p2#comment-5572 so I do not really have more details I'm afraid. |
I was able to see the fatal Jeremy had mentioned with the search module deactivated:
With this PR patched, the fatal is fixed.
If the search module is deactivated, then jetpack/projects/plugins/jetpack/modules/widgets.php Lines 14 to 33 in 5e20900
I also did a check with all of the modules deactivated, but didn't see any other PHP errors when editing widgets, just some JS notices of block registration failures do to missing modules. |
Great news! One last step: head over to your WordPress.com diff, D69277-code, and commit it. Thank you! |
r235602-wpcom |
@samiff Thanks for looking into this, really appreciate that 👍 |
# By Jeremy Herve (5) and others # Via GitHub * master: (26 commits) Colors: update Primary green reference to match latest brand book (#21741) JS Connection: Moves registerSite logic to the store (#21732) Search: Add essential scaffolding for package (#21814) Search: avoid registering the widget when the module is not active (#21588) Add Video Tracks Support to VideoPress Block (#21578) Add deprecated to VideoPress block (#21802) Admin Menu: Make API tests compatible with WPCOM (#21850) External Media: Short-circuit requests earlier in the stack (#21854) Add Busy State to License Activation Flow Button (#21861) Fixed an issue with screen resolutions of under 783px that caused the content to not be properly displayed when the nav-unification is expanded on wp-admin. (#21869) E2E tests: migrate from Jest to Playwright runner (#21848) Update reCAPTCHA constants to match Google's Verbage (#12289) JITM: Sideload Jetpack Boost functionality (#21860) Connection: properly add GET-parameters for the `fetchAuthorizationUrl` API call (#21750) License Flow: Assorted Styling Improvements (#21859) JITM: Sideload Jetpack Backup (#21719) Widget Visibility: Apply widget filtering to customizer preview (#21505) jetpack: Avoid generating unused JS for static-site-generator assets (#21789) Nav Unification: Support absolute URLs in upsell nudges (#21821) RePublicize: Enable the block editor UI by default (#21855) ... # Conflicts: # projects/plugins/boost/tests/e2e/lib/env/prerequisites.js # projects/plugins/boost/tests/e2e/lib/setupTests.js
Fixes #21587
Changes proposed in this Pull Request:
The
Jetpack_Search
class will not be loaded if the Search module is not active. So let's not register the widget when the feature is not available.Jetpack product discussion
Does this pull request change what data or activity we track or use?
Testing instructions: