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

Add/module products #22596

Merged
merged 6 commits into from
Feb 1, 2022
Merged

Add/module products #22596

merged 6 commits into from
Feb 1, 2022

Conversation

leogermani
Copy link
Contributor

Adds the backend for Module Products

Changes proposed in this Pull Request:

  • Adds the backend for Module Products

Jetpack product discussion

p9dueE-4g1-p2

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

No

Testing instructions:

  • Watch tests
  • Look at code
  • Try to activate/deactivate one of these products via REST API?

@leogermani leogermani added the [Status] Needs Review To request a review from Crew. Label will be renamed soon. label Feb 1, 2022
@leogermani leogermani self-assigned this Feb 1, 2022
@github-actions
Copy link
Contributor

github-actions bot commented Feb 1, 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.

@oskosk oskosk added this to the My Jetpack MVP milestone Feb 1, 2022
@retrofox
Copy link
Contributor

retrofox commented Feb 1, 2022

Leaving a note, modules like scan require additional settings:

When I try to activate it, I get the following error:

Another good reason to keep with the same single product management path,

}

if ( ! class_exists( 'Jetpack' ) ) {
return new WP_Error( 'plugin_activation_failed', __( 'Error activating Jetpack plugin', 'jetpack-my-jetpack' ) );
Copy link
Contributor

Choose a reason for hiding this comment

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

I think in general we should add an array( 'status' => XXX ) as the third parameter of the error instance. It will help to deal with the errors on the client-side.
For instance, when I try to activate the scan product I gen an error which is expected (comment here). However, the error status code is 500 from the request, and it doesn't contain any status in its response (data null).

I wonder if we can use one of the standard codes when it fails.
In this case, may we use 401?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure! This should be handled by the REST API endpoint. Let's address this in another PR

Copy link
Contributor

Choose a reason for hiding this comment

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

ok, it can get trickier from there since we'll have to check the type of error before populating the error.
Generally, it just checks if is_wp_error(). If so, it just sends the error to the client.

retrofox
retrofox previously approved these changes Feb 1, 2022
Copy link
Contributor

@retrofox retrofox left a comment

Choose a reason for hiding this comment

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

Left a comment about response error, we can polish it in follow-up PRs, though.
It works as expcted. I could activate/deactivate the VideoPress module from My Jetpack properly.
LGTM.

@leogermani leogermani enabled auto-merge (squash) February 1, 2022 18:02
@leogermani leogermani merged commit e053d2b into master Feb 1, 2022
@leogermani leogermani deleted the add/module-products branch February 1, 2022 18:04
@github-actions github-actions bot removed the [Status] Needs Review To request a review from Crew. Label will be renamed soon. label Feb 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants