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: Fix search on private WordPress.com-on-Atomic sites #24099

Merged
merged 3 commits into from
May 3, 2022

Conversation

jsnmoon
Copy link
Member

@jsnmoon jsnmoon commented Apr 26, 2022

Fixes #24197.

Changes proposed in this Pull Request:

Fixes search on private WordPress.com-on-Atomic (WoA) sites by signing the requests with a blog token instead of a user token.

Also changes the local API URL to the one provided by the search package instead of the one provided by the Jetpack plugin.

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

No.

Testing instructions:

Note: This PR is only testable by a12s.

  1. Spin up a WoA site (either via Pro plan purchase + Jetpack Beta plugin install or via WoA developer blogs — p9o2xV-1r2).
  2. Purchase Jetpack Search for the WoA site.
  3. Navigate to /?s=. Ensure that the search interface works as expected.
  4. Navigate to https://wordpress.com/settings/general/ and change site visibility to Private.
  5. Repeat the site search from step 3; ensure that the search API request fails in the network console.
  6. Install the Jetpack Beta plugin (if you haven't in step 1) and change the plugin branch to this one.
  7. Repeat step 5; ensure that the search API request succeeds.
  8. Revert the site privacy back to Public and repeat step 5, just in case.

@jsnmoon jsnmoon added the DO NOT MERGE don't merge it! label Apr 26, 2022
@github-actions github-actions bot added the [Package] Search Contains core Search functionality for Jetpack and Search plugins label Apr 26, 2022
@github-actions
Copy link
Contributor

github-actions bot commented Apr 26, 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.

@github-actions github-actions bot added the [Status] Needs Author Reply We would need you to make some changes or provide some more details about your PR. Thank you! label Apr 26, 2022
@jsnmoon jsnmoon added [Status] In Progress 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 Apr 26, 2022
@jsnmoon jsnmoon marked this pull request as ready for review April 27, 2022 00:03
@jsnmoon jsnmoon requested a review from a team as a code owner April 27, 2022 00:03
@jsnmoon jsnmoon marked this pull request as draft April 27, 2022 00:04
@jsnmoon jsnmoon removed the request for review from a team April 27, 2022 00:04
@jsnmoon jsnmoon force-pushed the try/private-atomic-search-auth branch 7 times, most recently from 4f6869e to 0161451 Compare April 28, 2022 23:13
@jsnmoon jsnmoon force-pushed the try/private-atomic-search-auth branch from 0161451 to 2844cff Compare April 29, 2022 21:39
@jsnmoon jsnmoon changed the title Test PR Search: Fix search on private WordPress.com-on-Atomic sites Apr 29, 2022
@jsnmoon jsnmoon self-assigned this Apr 29, 2022
@jsnmoon jsnmoon added the [Type] Bug When a feature is broken and / or not performing as intended label Apr 29, 2022
@jsnmoon jsnmoon marked this pull request as ready for review April 29, 2022 21:56
@jsnmoon jsnmoon requested a review from a team April 29, 2022 21:56
@jsnmoon jsnmoon added this to the jetpack/10.9 milestone Apr 29, 2022
@jsnmoon
Copy link
Member Author

jsnmoon commented Apr 29, 2022

I believe this regression was introduced in #21584. @kangzj, do we know why we changed to signing with user tokens here?

@kangzj
Copy link
Contributor

kangzj commented May 1, 2022

@jsnmoon Yep I think so, this is a bug - I guess I didn't anticipate a local user isn't necessary a WPCOM user in the previous PR.

@kangzj
Copy link
Contributor

kangzj commented May 2, 2022

Hi @jsnmoon, could you please share more details about how to create a WoA site? I'm not sure how I set up one - should I use the sandbox, a ephemeral site or sth else?

@jsnmoon
Copy link
Member Author

jsnmoon commented May 2, 2022

Hi @jsnmoon, could you please share more details about how to create a WoA site? I'm not sure how I set up one - should I use the sandbox, a ephemeral site or sth else?

The consumer-centric way would be to spin up a regular WordPress.com site, purchase a Pro plan, and install a plugin on it. I'll share the more dev-friendly method (internal to a8c) privately.

Copy link
Contributor

@kangzj kangzj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for fixing this. It works for me 👍

@jsnmoon jsnmoon merged commit f018777 into master May 3, 2022
@jsnmoon jsnmoon deleted the try/private-atomic-search-auth branch May 3, 2022 01:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Package] Search Contains core Search functionality for Jetpack and Search plugins [Pri] Normal [Type] Bug When a feature is broken and / or not performing as intended
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Search: Search fails on private WoA sites
3 participants