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

Masterbar: Require and use 'jetpack-masterbar' package in jetpack-mu-wpcom #37812

Merged
merged 25 commits into from
Jun 19, 2024

Conversation

fgiannar
Copy link
Contributor

@fgiannar fgiannar commented Jun 12, 2024

Important: This PR should be merged after JP 13.6-a.3 or later is released on AT. Context: #37812 (comment)

Jetpack 13.6-a.5 is now released to AT: p9o2xV-4mW-p2

Masterbar: Require and use 'jetpack-masterbar' package in jetpack-mu-wpcom

This is needed as we are slowly deprecating the feature for self-hosted sites.

Proposed changes:

  • Masterbar package: Refactored Admin_Color_Schemes to incorporate the logic from the corresponding feature in jetpack-mu-wpcom
  • Masterbar package: Update Main class so that it behaves consistently with the WPCOM masterbar mu-plugin. Aka with Simple sites in mind.
  • Jetpack-mu-wpcom package: Load Masterbar features on WoA sites (this is only temp as the we plan to make it available to Simple sites too)
  • Jetpack-mu-wpcom package: Refactor admin-color-schemes.php to simply instantiate Admin_Color_Schemes upon loading only for classic Simple sites (also temp).

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-3U-p2

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

No

Testing instructions:

We'll need to repeat the testing from #37676 with the following extras:

Simple Sites

We are mostly interested in classic Simple sites. These are the ones where wpcom_is_nav_redesign_enabled() will be true. This means that return get_blog_option( YOUR_WPCOM_BLOG_ID, 'wpcom_admin_interface' ) returns wp-admin. I was under the impression that switching to the Classic view would reflect this but it wasn't the case for me, so I had to manually set the wpcom_admin_interface option to wp-admin for my Simple site.

User Profile

  • Verify that the Admin Color Scheme setting in profile.php screen looks the same with/without the PR applied.
  • Try switching Color Schemes and verify the changes are applied (no need to save).

Atomic Sites

We'll need to test with the provided instructions below but also with Jetpack on the current JP version on WoA aka 13.6-a.5 and the WordPress.com Features plugin on this branch via Jetpack beta. This will simulate the period between the next wpcomsh release and the next Jetpack AT release.

We'll need to test both classic and default WoA sites. You can toggle this option via Settings->General in wp-admin for a classic WoA site

Screenshot 2024-06-13 at 14 29 19

You can toggle this option via Settings->General in Calypso for a Default WoA site:

Screenshot 2024-06-18 at 13 06 21

TODO: On a WoA default site, the Appearance->Additonal CSS link redirects you to wp-admin with an error message that you don't have access. Is this intended?

Copy link
Contributor

github-actions bot commented Jun 12, 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 add/masterbar-package-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 add/masterbar-package-to-jetpack-mu-wpcom
    
    bin/jetpack-downloader test jetpack-mu-wpcom-plugin add/masterbar-package-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 Jun 12, 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 July 2, 2024 (scheduled code freeze on July 1, 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: July 2, 2024.
  • Scheduled code freeze: June 24, 2024.

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


Wpcomsh plugin:

  • Next scheduled release: July 2, 2024.
  • Scheduled code freeze: June 24, 2024.

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

@github-actions github-actions bot added [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ [Plugin] mu wpcom jetpack-mu-wpcom plugin labels Jun 12, 2024
… require the masterbar file that loads the admin menu for self-hosted
@fgiannar fgiannar added [Status] Needs Review To request a review from fellow Jetpack developers. Label will be renamed soon. [Status] Needs Team Review and removed [Status] In Progress [Status] Needs Review To request a review from fellow Jetpack developers. Label will be renamed soon. labels Jun 13, 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 looks great!

On reviewing the code, it all looks good.

I tested on Simple, Atomic, self-hosted. I think most of what I found may not even be issues, but I'll add them here:

Important: Without the PR, only jetpack-core-color-schemes-overrides-sidebar-notice-css is loaded but my understanding based on the linked Jetpack product discussion above is that this is the desired behaviour.

On my test Atomic, neither was loaded when the PR wasn't applied. The color schemes looked and behaved the same though.

For block based themes, "Customize" should not be present under "Appearance".
(from the linked PR)

Testing on a Simple site, using block based theme (Twenty Twenty Four), I see Customize under Appearance. However I do with trunk too. Same with Classic or Default interface style. Atomic behaves as the PR description suggests though.

On a WoA default site, the Appearance->Additonal CSS link redirects you to wp-admin with an error message that you don't have access. Is this intended?

I couldn't replicate that. I know I mentioned in Slack I'd seem the message briefly, but that was while testing the Custom CSS PR, not this one.

@fgiannar
Copy link
Contributor Author

Thanks for the review, @coder-karen !

Unfortunately I'm able to reproduce a Fatal when testing the admin-menu endpoint on a WoA site on JP 13.6-a.1 and the WordPress.com Features plugin on this branch via Jetpack beta.

Cannot redeclare Automattic\Jetpack\Masterbar\should_customize_nav()

I think the safest approach here would be extracting the suggested change in the endpoint from this PR to another PR, then merge it so it's available on the next AT release and merging this one afterwards so it becomes available to WoA sites via the corresponding wpcomsh update.

@fgiannar
Copy link
Contributor Author

Many many thanks, @coder-karen !

Important: Without the PR, only jetpack-core-color-schemes-overrides-sidebar-notice-css is loaded but my understanding based on the linked Jetpack product discussion above is that this is the desired behaviour.

This applies to classic Simple sites and the profile.php screen in wp-admin.

Testing on a Simple site, using block based theme (Twenty Twenty Four), I see Customize under Appearance. However I do with trunk too. Same with Classic or Default interface style. Atomic behaves as the PR description suggests though.

It would be nice to get a confirmation around the intended behaviour from the product teams cc @mmtr

I couldn't replicate that. I know I mentioned in Slack I'd seem the message briefly, but that was while testing the Custom CSS PR, not this one.

I'm also not able to reproduce this one anymore but will keep an eye in case it happens again while testing.

@fgiannar fgiannar requested review from mmtr and fushar June 17, 2024 11:30
@fgiannar fgiannar added the [Status] Needs Review To request a review from fellow Jetpack developers. Label will be renamed soon. label Jun 17, 2024
mmtr
mmtr previously approved these changes Jun 18, 2024
Copy link
Member

@mmtr mmtr left a comment

Choose a reason for hiding this comment

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

Impressive work, @fgiannar.

This works as expected to me, with no regressions in the behavior when I compare it against trunk.

Tested in 5 different environments:

  • WP.com Simple Default: Color schemes are correctly overridden and I can only change them in Calypso
  • WP.com Simple Classic: Color schemes are correctly overridden and I can only change them in WP Admin
  • WP.com Atomic Default: Color schemes are correctly overridden and I can only change them in Calypso
  • WP.com Atomic Classic: Color schemes are correctly overridden and I can only change them in WP Admin
  • Self-hosted sites: Color schemes are correctly overridden when the toolbar module is enabled and I can change them in WP Admin. The selected color scheme is not synced with Calypso, as expected.

EDIT: Somehow I thought I only had to test the admin color schemes changes. I'll review the rest of features tomorrow.

@mmtr mmtr dismissed their stale review June 18, 2024 15:24

Just realized I only tested the color schemes, but changes affect to the whole masterbar module, which should be tested entirely

Copy link
Member

@mmtr mmtr left a comment

Choose a reason for hiding this comment

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

Made sure to test everything now, and it works as expected 🚀

Testing on a Simple site, using block based theme (Twenty Twenty Four), I see Customize under Appearance. However I do with trunk too. Same with Classic or Default interface style. Atomic behaves as the PR description suggests though.

Yeah, this is unrelated to these changes, because it happens in trunk as well. Due to a bug, the "Appearance > Customize" menu is visible on Simple Default sites when visiting a WP Admin page. It does not happen in other scenarios (Simple Default visiting Calypso, Simple Classic visiting any page).

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.

Retested color schemes in particular on all site types, default and classic styles, as that was the only change since my last review. All tests well :)

@fgiannar fgiannar merged commit 2db5b61 into trunk Jun 19, 2024
57 checks passed
@fgiannar fgiannar deleted the add/masterbar-package-to-jetpack-mu-wpcom branch June 19, 2024 09:27
@github-actions github-actions bot removed [Status] Needs Review To request a review from fellow Jetpack developers. Label will be renamed soon. [Status] Needs Team Review labels Jun 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Masterbar WordPress.com Toolbar and Dashboard customizations [mu wpcom Feature] Admin Color Schemes [Package] Jetpack mu wpcom WordPress.com Features [Package] Masterbar [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ [Plugin] mu wpcom jetpack-mu-wpcom plugin [Plugin] Wpcomsh [Tests] Includes Tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Masterbar package: Require the package in both the Jetpack plugin and the mu-wpcom plugin
3 participants