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

WordPress.com Block Editor Deprecate and move functionality to mu wpcom #37324

Open
wants to merge 30 commits into
base: trunk
Choose a base branch
from

Conversation

darssen
Copy link
Contributor

@darssen darssen commented May 9, 2024

Proposed changes:

  • Deprecate WordPress.com Block Editor for self-hosted
  • Move the functionality to jetpack-mu-wpcom package
  • Fixed Unit Tests while moving them

Regarding deprecation notices and removal of the code, I took a different approach to #37260 or #37189 since the jetpack-mu-wpcom package is not available for the jetpack plugin.
The steps I take are as follows. After removing the loading of the file from the module-extras.php I decided to mark the file as deprecated as well as the init and the constructor. But leave the file as is since I cannot replace the functionality with the one in the mu-wpcom package due to being out of reach.

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

pfwV0U-9G-p2

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

No

Testing instructions:

  • Check in self-hosted and see that Justify and Underline formatting Tools are no longer available.
    image

  • Make sure deprecation notices are not present unless the Class is declared explicitly.

  • Check that Simple and WoA still keep the justify and Underline formatting Tools

@darssen darssen added [Feature] WordPress.com Block Editor [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ [Package] Jetpack mu wpcom WordPress.com Features [Plugin] mu wpcom jetpack-mu-wpcom plugin [Focus] Jetstream labels May 9, 2024
@darssen darssen self-assigned this May 9, 2024
Copy link
Contributor

github-actions bot commented May 9, 2024

Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.

  • To test on WoA, go to the Plugins menu on a WordPress.com Simple site. Click on the "Upload" button and follow the upgrade flow to be able to upload, install, and activate the Jetpack Beta plugin. Once the plugin is active, go to Jetpack > Jetpack Beta, select your plugin, and enable the update/move-wpcom-block-editor-to-jetpack-mu-wpcom branch.

    • For jetpack-mu-wpcom changes, also add define( 'JETPACK_MU_WPCOM_LOAD_VIA_BETA_PLUGIN', true ); to your wp-config.php file.
  • To test on Simple, run the following command on your sandbox:

    bin/jetpack-downloader test jetpack update/move-wpcom-block-editor-to-jetpack-mu-wpcom
    
    bin/jetpack-downloader test jetpack-mu-wpcom-plugin update/move-wpcom-block-editor-to-jetpack-mu-wpcom
    

Interested in more tips and information?

  • In your local development environment, use the jetpack rsync command to sync your changes to a WoA dev blog.
  • Read more about our development workflow here: PCYsg-eg0-p2
  • Figure out when your changes will be shipped to customers here: PCYsg-eg5-p2

Copy link
Contributor

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


Jetpack plugin:

The Jetpack plugin has different release cadences depending on the platform:

  • WordPress.com Simple releases happen daily.
  • WoA releases happen weekly.
  • Releases to self-hosted sites happen monthly. The next release is scheduled for June 4, 2024 (scheduled code freeze on June 3, 2024).

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


Mu Wpcom plugin:

  • Next scheduled release: June 4, 2024.
  • Scheduled code freeze: May 27, 2024.

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

@darssen darssen marked this pull request as ready for review May 10, 2024 07:53
@darssen darssen requested a review from a team May 10, 2024 07:53
@darssen darssen requested a review from jeherve May 10, 2024 11:12
@darssen darssen requested a review from a team May 10, 2024 13:49
@darssen darssen added [Status] Needs Review To request a review from Crew. Label will be renamed soon. and removed [Status] In Progress labels May 14, 2024
Copy link
Contributor

@coder-karen coder-karen left a comment

Choose a reason for hiding this comment

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

This tests well for me on self-hosted. On Atomic it also tests well.

Simple also works - however I'm not sure we need to consider Simple as from what I can see the same code is loaded via the gutenberg-wpcom plugin. Whether it's related to being loaded twice or not, I also seem to be getting ongoing console errors on Simple related to the gutenberg-wpcom plugin (Uncaught TypeError: Cannot read properties of undefined (reading 'apiFetchUnknown')) - moving back to production those are gone.
I wonder if it is worth adding a check in the jetpack-mu-wpcom package to make sure a site is Atomic before requiring the files?

@coder-karen coder-karen 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 May 22, 2024
@darssen
Copy link
Contributor Author

darssen commented May 22, 2024

This tests well for me on self-hosted. On Atomic it also tests well.

Simple also works - however I'm not sure we need to consider Simple as from what I can see the same code is loaded via the gutenberg-wpcom plugin. Whether it's related to being loaded twice or not, I also seem to be getting ongoing console errors on Simple related to the gutenberg-wpcom plugin (Uncaught TypeError: Cannot read properties of undefined (reading 'apiFetchUnknown')) - moving back to production those are gone. I wonder if it is worth adding a check in the jetpack-mu-wpcom package to make sure a site is Atomic before requiring the files?

Thanks for reviewing!

Nice catch on the console log for Simple. I've been investigating and seems that the issue was coming because wp_localize_script with same object_name wpcomGutenberg was being used in both places ( gutenberg-wpcom plugin code as well as the code introduced in this PR). This was creating some issues since the wpcomGutenberg variable in Gutenberg is actually storing more info. I decided to change the name for the code in this PR.

namespace Jetpack\EditorType;

_deprecated_file( __FILE__, 'jetpack-$$next-version$$', 'Automattic\\Jetpack\\Jetpack_Mu_Wpcom\\WPCOM_Block_Editor\\EditorType' );
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have marked this file as deprecated too. This implies that we need to take care of only existing use I have been able to find since now it is using deprecated code. D149564-code should take care of it.

Comment on lines +161 to +163
if ( ! ( new Host() )->is_woa_site() ) {
add_filter( 'jetpack_sso_bypass_login_forward_wpcom', '__return_true' );
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Do we want to keep this? We might be able to just leave the flow regarding sso not being active.

@darssen darssen 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 May 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] WordPress.com Block Editor [Focus] Jetstream [mu wpcom Feature] WordPress.com Block Editor [Package] Jetpack mu wpcom WordPress.com Features [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ [Plugin] mu wpcom jetpack-mu-wpcom plugin [Status] Needs Review To request a review from Crew. Label will be renamed soon. [Tests] Includes Tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants