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

Classic Theme Helper Plugin: Ensure Featured Content and imported / required files in the package are initialized #38156

Merged

Conversation

coder-karen
Copy link
Contributor

@coder-karen coder-karen commented Jul 2, 2024

Fixes https://github.com/Automattic/vulcan/issues/384

Proposed changes:

  • This PR ensures the classes that initialize both Featured Content and Responsive Videos from the Classic Theme Helper package are initialized in the plugin, so they can work even if Jetpack is not also initializing those classes.

This PR only considers the features that have been added to the Classic Theme Helper package and focuses on loading them when the plugin is active. More may be needed on the plugin generally, but that can be covered in later work: https://github.com/Automattic/vulcan/issues/388

This also assumes the current version of Jetpack in use on a site is the equivalent of trunk, as it isn't expected this plugin would be publicly used (with the current latest stable v of Jetpack or 13.7) until around Jetpack 13.8 or later. We may want to gate requiring / initializing files and classes to certain Jetpack versions to avoid issues, but that may need some discussion - mentioned here: https://github.com/Automattic/vulcan/issues/388

Other information:

  • Have you written new tests for your changes, if applicable?
  • Have you checked the E2E test CI results, and verified that your changes do not break them?
  • Have you tested your changes on WordPress.com, if applicable (if so, you'll see a generated comment below with a script to run)?

Jetpack product discussion

https://github.com/Automattic/vulcan/issues/384

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

No.

Testing instructions:

Replicating the issue:

  • If testing locally, make sure you have installed and built the Classic Helper Theme plugin: jetpack install plugins/classic-theme-helper-plugin, jetpack build plugins/classic-theme-helper-plugin, then activate the plugin.
  • Also if testing locally, remove "automattic/jetpack-classic-theme-helper": "@dev", from the Jetpack plugin composer.json file. Then run run tools/fixup-project-versions.sh, and then jetpack install plugins/jetpack and jetpack build plugins/jetpack.
  • If testing using the Beta tester plugin, activate 'Bleeding Edge' for the Classic Theme Helper plugin.
  • Comment out theme-tools/responsive-videos.php' and theme-tools/featured-content.php from projects/plugins/jetpack/modules/module-extras.php (via SFTP if using a test site and the Beta tester plugin)
  • If testing using the Beta tester plugin, delete the jetpack-classic-theme-helper package folder from jetpack/jetpack-vendor/automattic.
  • Follow the steps in this PR to test Responsive Videos and Featured Content (only on self-hosted): Classic Theme Helper: Requiring the Responsive Video package files, and modifying Featured Content require process #37969
  • They shouldn't work.

To test the fix:

  • Apply this PR if testing locally or using the Beta tester plugin (activating the branch for the Classic Theme Helper plugin).
  • Follow the same steps as above (from 'comment out' if using the Beta tester plugin)
  • Responsive Videos and Featured Content should work as expected - and the source of the scripts when viewed in page source should be the Classic Theme Helper plugin (not the Jetpack Mu Wpcom plugin or Jetpack).
Copy link
Contributor

github-actions bot commented Jul 2, 2024

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.
  • ✅ 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 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 reviewed, it can then be merged.
If you need an extra review from someone familiar with the codebase, you can update the labels from "[Status] Needs Team Review" to "[Status] Needs Review", and in that case Jetpack Approvers will do a final review of your PR.


Classic Theme helper plugin plugin:

  • Next scheduled release: August 6, 2024.
  • Scheduled code freeze: July 29, 2024.

If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack.

@coder-karen coder-karen changed the title Classic Theme Helper Plugin: Ensure Featured Content and and imported / required files in the package are initialized Jul 2, 2024
* @return void
*/
function init_packages() {
if ( class_exists( 'Automattic\Jetpack\Classic_Theme_Helper\Main' ) ) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The class_exists check was added in here as it makes sense to have the check in case there are any package loading issues, but also because tests were failing (on deactivation and uninstallation of the plugin, as the class 'didn't exist').

@coder-karen coder-karen marked this pull request as ready for review July 5, 2024 14:14
@coder-karen coder-karen added [Status] Needs Review To request a review from Crew. Label will be renamed soon. and removed [Status] In Progress labels Jul 5, 2024
@coder-karen coder-karen requested a review from a team July 5, 2024 14:57
@@ -57,6 +57,7 @@
"mirror-repo": "Automattic/classic-theme-plugin",
"release-branch-prefix": "classic-theme-plugin",
"beta-plugin-slug": "classic-theme-helper-plugin",
"wp-plugin-slug": "classic-theme-helper-plugin",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This change is technically not related to this PR, but the PR provides a good opportunity to add this back in (it was removed in another PR but the removal wasn't necessary - more info here: #38175 (comment) )

Copy link
Contributor

@darssen darssen left a comment

Choose a reason for hiding this comment

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

Tests as expected 👍

@coder-karen coder-karen merged commit 45b955c into trunk Jul 9, 2024
61 of 62 checks passed
@coder-karen coder-karen deleted the update/classic-helper-theme-plugin-videos-featured-content branch July 9, 2024 10:58
@coder-karen coder-karen removed the [Status] Needs Review To request a review from Crew. Label will be renamed soon. label Jul 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment