Skip to content

Conversation

@dereksmart
Copy link
Contributor

@dereksmart dereksmart commented May 16, 2022

It's an ugly refactor, stuffs Jetpack-specific logic into a class_exists check. However it allows standalone plugins to use the Modules()->activate() method.

Changes proposed in this Pull Request:

  • Refactors Modules()->activate() to execute Jetpack-specific logic only when Jetpack is present.
  • Updates Search activation method to use it directly.
  • Updates Search deactivation method to use the Module class method - there was no Jetpack-specific logic there.

Jetpack product discussion

  • p1652392614473149-slack-CBG1CP4EN
  • pdWQjU-o-p2

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

No

Testing instructions:

  • Set up a site with Search plan
  • Enable/disable the Search setting from the Search plugin when Jetapck is not active.
  • When activating Jetpack, make sure the status is accurate.

Make sure that activating the modules from Jetpack also works:

  • From the settings UI
  • From /wp-admin/admin.php?page=jetpack_modules
  • From wp-cli
  • From Calypso settings

@dereksmart dereksmart requested a review from a team as a code owner May 16, 2022 20:59
@github-actions github-actions bot added [Package] Search Contains core Search functionality for Jetpack and Search plugins [Package] Status labels May 16, 2022
@github-actions
Copy link
Contributor

github-actions bot commented May 16, 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.

kangzj
kangzj previously approved these changes May 17, 2022
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.

Hi @dereksmart, thanks for fixing this! Really appreciate it - this would save us hours if not days exploring! 👍

It works as described. I left a question but which doesn't seem a blocker to me 💯

}
// Not available for offline mode.
$is_offline_mode = ( new Status() )->is_offline_mode();
if ( $is_offline_mode ) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm wondering how Search plugin would claim it needs connection by using the Modules class?

Copy link
Contributor

Choose a reason for hiding this comment

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

This doesn't seems to matter a lot for standalone plugins tho, since if site is not connected, the search dashboard wouldn't be shown anyway.

@kangzj
Copy link
Contributor

kangzj commented May 19, 2022

Hey @dereksmart any plan to merge this? I do think better to have more people testing it before merging.

Hey @Automattic/jetpack-search peeps, if you have some time, would you mind spinning of this PR?

@dereksmart
Copy link
Contributor Author

hey @kangzj sorry I was waiting some to see if it'd help Social plugin with their issue. It doesn't really, but it does get it a bit closer as they were hitting the file checks anyway. I'll clean it up tomorrow and get more testing so we can merge and can work on the rest in follow-ups. Started a branch in add/debug-helper-modules and hoping to provide some easier ways to debug these modules via the debug plugin.

@kangzj
Copy link
Contributor

kangzj commented May 19, 2022

Thanks for your kind reply. This doesn't block Search anyway, take your time 💯

@dereksmart dereksmart added [Status] Needs Review This PR is ready for review. and removed [Status] In Progress labels May 19, 2022
Copy link
Contributor

@leogermani leogermani left a comment

Choose a reason for hiding this comment

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

I've tested in different scenarios... tested integrating it with My Jetpack and also tested for regressions within the Jetpack plugin and it looks good to me

@dereksmart dereksmart merged commit ce85409 into master May 19, 2022
@dereksmart dereksmart deleted the update/module-methods-jetpack-agnostic branch May 19, 2022 19:56
@github-actions github-actions bot removed the [Status] Needs Review This PR is ready for review. label May 19, 2022
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 [Package] Status

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants