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

Search: migrate search widget to package #22364

Merged
merged 28 commits into from
Feb 3, 2022
Merged

Conversation

kangzj
Copy link
Contributor

@kangzj kangzj commented Jan 17, 2022

Changes proposed in this Pull Request:

The PR moves Jetpack Search widget to the search package. Changes include:

  • Moved assets to the search package.
  • Text domain changed to jetpack-search-pkg
  • Moved initialization to Jetpack_Initializer
  • Some other changes regarding namespace change

PHP linter tried to arrange the order of the functions which lead to possibly hard review, and had to re-order and commit with --no-verify.

Jetpack product discussion

pcNPJE-oI-p2

Does this pull request change what data or activity we track or use?

no

Testing instructions:

  • Navigate to a site with Jetpack Search subscription
  • Disable Instant search
  • Add Jetpack Search widget to sidebar
  • Ensure assets load on the frontend: search-widget-frontend.js and search-widget-frontend.css (the style file is concatenated in /wp-content/plugins/jetpack/css/jetpack.css)
  • Ensure Jetpack Search widget works in widget editor and customizer, meaning you could add/remove filters and save changes
  • Ensure Jetpack Search widget works on the frontend for both Instant and Classic Search

Note: please use a theme that supports widgets (e.g. theme twentytwenty) as FSE themes don't have widget areas.

@kangzj kangzj self-assigned this Jan 17, 2022
@kangzj kangzj requested a review from a team as a code owner January 17, 2022 01:54
@github-actions github-actions bot added [Package] Search Contains core Search functionality for Jetpack and Search plugins [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ [Feature] Extra Sidebar Widgets labels Jan 17, 2022
@github-actions
Copy link
Contributor

github-actions bot commented Jan 17, 2022

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 you’ve done so, switch to the "[Status] Needs Review" label; someone from Jetpack Crew will then review this PR and merge it to be included in the next Jetpack release.


Jetpack plugin:

  • Next scheduled release: March 1, 2022.
  • Scheduled code freeze: February 22, 2022.

@kangzj kangzj changed the title Search: move search widget to package Search: migrate search widget to package Jan 17, 2022
@matticbot
Copy link
Contributor

Caution: This PR has changes that must be merged to WordPress.com
Hello kangzj! These changes need to be synced to WordPress.com - If you 're an a11n, please commandeer and confirm D73301-code works as expected before merging this PR. Once this PR is merged, please commit the changes to WP.com. Thank you!
This revision will be updated with each commit to this PR

@kangzj kangzj added [Status] Needs Review To request a review from Crew. Label will be renamed soon. and removed [Status] Needs Author Reply We would need you to make some changes or provide some more details about your PR. Thank you! labels Jan 26, 2022
@jeherve jeherve added this to the jetpack/10.7 milestone Jan 28, 2022
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'm not sure if I'm doing something wrong, but I don't see the widget's JS and CSS being enqueued on the frontend, whether concatenation is enabled or disabled (with define( 'SCRIPT_DEBUG', true );). Does it work for you?

I also get to see this warning on a JN site where concatenation is disabled:

PHP Warning:  filemtime(): stat failed for /wp-content/plugins/jetpack-dev/jetpack_vendor/automattic/jetpack-search/src/widgets/js/search-widget-admin.js in /wp-content/plugins/jetpack-dev/jetpack_vendor/automattic/jetpack-assets/src/class-assets.php on line 374

@jeherve jeherve added [Status] Needs Author Reply We would need you to make some changes or provide some more details about your PR. Thank you! and removed [Status] Needs Review To request a review from Crew. Label will be renamed soon. labels Jan 28, 2022
@kangzj
Copy link
Contributor Author

kangzj commented Feb 3, 2022

Hi @jeherve thanks for your feedback. The assets only load for Classic Search as it did. I tried to keep everything as they were. Sorry the instructions weren't so clear. Just updated, would you mind testing it again? Thanks.

@kangzj kangzj requested a review from jeherve February 3, 2022 02:44
@kangzj kangzj added [Status] Needs Review To request a review from Crew. Label will be renamed soon. and removed [Status] Needs Author Reply We would need you to make some changes or provide some more details about your PR. Thank you! labels Feb 3, 2022
@kangzj kangzj force-pushed the search/move-widget-to-package branch from 20cdf40 to e831bd4 Compare February 3, 2022 02:45
@kangzj
Copy link
Contributor Author

kangzj commented Feb 3, 2022

PHP Warning: filemtime(): stat failed for /wp-content/plugins/jetpack-dev/jetpack_vendor/automattic/jetpack-search/src/widgets/js/search-widget-admin.js in /wp-content/plugins/jetpack-dev/jetpack_vendor/automattic/jetpack-assets/src/class-assets.php on line 374

This possibly is a @anomiex question, becuase I could see warnings for other scripts as well.

[03-Feb-2022 02:46:33 UTC] PHP Warning:  filemtime(): stat failed for /usr/local/src/jetpack-monorepo/projects/packages/jitm/src/../build/index.js in /usr/local/src/jetpack-monorepo/projects/packages/assets/src/class-assets.php on line 374

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.

Looking good, let's merge this! 🚢

@jeherve jeherve added [Status] Ready to Merge Go ahead, you can push that green button! and removed [Status] Needs Review To request a review from Crew. Label will be renamed soon. labels Feb 3, 2022
@jeherve jeherve merged commit 4ef58af into master Feb 3, 2022
@jeherve jeherve deleted the search/move-widget-to-package branch February 3, 2022 12:41
@github-actions
Copy link
Contributor

github-actions bot commented Feb 3, 2022

Great news! One last step: head over to your WordPress.com diff, D73301-code, and commit it.
Once you've done so, come back to this PR and add a comment with your changeset ID.

Thank you!

@github-actions github-actions bot removed the [Status] Ready to Merge Go ahead, you can push that green button! label Feb 3, 2022
@anomiex
Copy link
Contributor

anomiex commented Feb 3, 2022

This possibly is a @anomiex question

The jitm one probably means you didn't build packages/jitm in your local dev environment, so the built file isn't there to be served.

The search one is the opposite, files in packages/search's src/ are excluded from the mirror so they're not there to be served.

@kangzj
Copy link
Contributor Author

kangzj commented Feb 11, 2022

I tested the package on WPCOM which works fine. The changes regarding the search widget will be applied manually to WPCOM after next release. And fusion syncing will be removed accordingly.

cc @jsnmoon @bluefuton

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Extra Sidebar Widgets [Package] Search Contains core Search functionality for Jetpack and Search plugins [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ Touches WP.com Files
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants