Skip to content

Conversation

@fgiannar
Copy link
Contributor

@fgiannar fgiannar commented Jun 3, 2024

Load the Masterbar module (WordPress.com Toolbar) functionality from the masterbar-package instead of using the corresponding Module code, soon to be deprecated.

Proposed changes:

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:

Important! While testing on WoA make sure to also activate the WordPress.com Features plugin (Bleeding Edge just in case) via Beta Tester and add define( 'JETPACK_MU_WPCOM_LOAD_VIA_BETA_PLUGIN', true ); to your wp-config.php

nav-unification: Testing the admin menu in Simple, WoA and self-hosted:

You can test this in the WPCOM REST API Dev console for the wpcom/v2/sites/YOUR_BLOG_ID/admin-menu endpoint.

For block based themes, "Customize" should not be present under "Appearance".

Make sure to test with/without the PR applied and confirm the responses are identical. For Simple and WoA sites we'll also need to test with classic/default Admin Interface Style.

nav-unification: Admin color schemes

For self-hosted sites and classic WoA sites, upon editing a User Profile via wp-admin, confirm the Admin Color Scheme field is present:

Screenshot 2024-06-05 at 10 20 28

Ensure that by picking one of the options, the admin theme is updated.

For default WoA sites, upon editing a User Profile via wp-admin, confirm you see the following link to update the field on WPCOM:
Screenshot 2024-06-06 at 10 16 48

For a WoA site, this change should be also reflected in Calypso.

Confirm that the admin_color user meta is also part of the corresponding REST API response to the users endpoint.
You can test this in the WPCOM REST API Dev console for the wp/v2/sites/YOUR_BLOG_ID/users endpoint.

Make sure to test this with a self-hosted and WoA. Not applicable for Simple sites.

Classic vs Default view

Try switching between Classic vs Default view for a WoA and Simple site. Confirm nothing breaks and both views are displayed as expected.
Screenshot 2024-06-04 at 17 01 30

For self-hosted sites, this option should NOT be visible since there should be no nav customizations on WP Admin of Jetpack sites

For WoA sites with SSO disabled this option should NOT be visible since there should be no nav customizations on WP Admin of Atomic sites when SSO is disabled.

Editing a user profile on wp-admin for WoA sites

When editing a user's profile via wp-admin on a WoA site, confirm that you see the following message and the corresponding links to your WPCOM account page work as expected:

Screenshot 2024-06-05 at 10 02 12

Inline Help

TBA

Nudges to purchase a WordPress.com Plan to be able to customize CSS on your site (Simple and WoA sites)

Make sure your site is 1) using a non-block theme, eg Hever. and 2) IS NOT on the explorer plan
Navigate to Appearance -> Additional CSS and confirm you see the following nudge:

Screenshot 2024-06-05 at 11 08 09

Ensure the Upgrade flow is working as expected by clicking the "Upgrade now" button. You should be redirected to checkout with the Explorer plan in your cart.
Note sure how to test this on a WoA site

Disable edit_post and delete_post capabilities for Posts Pages in WP-Admin and display a notification icon.

See #19900

RTL support

Simple & WoA: Update your WPCOM user locale to Arab and ensure the Masterbar and Admin menu is displayed consistently with/without the PR.
Self hosted: Update your user locale to Arab and ensure the Masterbar and Admin menu is displayed consistently with/without the PR.
Let's make sure to test this as much as possible since the package loads RTL styles automatically via the Assets package.
Example: All the relevant $this->is_rtl() conditionals in the module code have been removed from the corresponding package code.

@github-actions
Copy link
Contributor

github-actions bot commented Jun 3, 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/use-masterbar-pkg-in-jetpack-plugin branch.

  • To test on Simple, run the following command on your sandbox:

    bin/jetpack-downloader test jetpack update/use-masterbar-pkg-in-jetpack-plugin
    

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

@github-actions github-actions bot added [Feature] Masterbar WordPress.com Toolbar and Dashboard customizations [Package] Masterbar [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ labels Jun 3, 2024
@github-actions
Copy link
Contributor

github-actions bot commented Jun 3, 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.

@fgiannar fgiannar added [Status] Needs Review This PR is ready for review. [Status] Needs Team Review Obsolete. Use Needs Review instead. and removed [Status] In Progress labels Jun 5, 2024
@fgiannar fgiannar requested review from a team, jeherve and mmtr June 5, 2024 11:44
*/
public function enqueue_scripts() {
$assets_base_path = '../../dist/admin-menu/';
if ( $this->is_rtl() ) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Clean up. This is no longer used below

@mmtr
Copy link
Member

mmtr commented Jun 5, 2024

Wow @fgiannar, impressive work! Everything seems to be working as expected for me.

Inline Help
TBA

Probably no longer needed now that the inline help is powered by the ETK plugin:

https://github.com/Automattic/wp-calypso/blob/fd360657e5d9095d1f7d96c58c3312da5460ff00/apps/editing-toolkit/editing-toolkit-plugin/help-center/src/help-center.scss#L14

Nudges to purchase a WordPress.com Plan to be able to customize CSS on your site (Simple and WoA sites)
Note sure how to test this on a WoA site

Yeah, me neither. When I removed the plan from SA, Jetpack gets deactivated so the masterbar module does not run. I guess it's not a big deal – it probably works as expected (and if it doesn't, in practice all Atomic sites have the needed plan except for a brief time after plan expiration, so we'll only have very few edge cases).

mmtr
mmtr previously approved these changes Jun 5, 2024
@bindlegirl bindlegirl added [Status] Ready to Merge Go ahead, you can push that green button! and removed [Status] Needs Review This PR is ready for review. [Status] Needs Team Review Obsolete. Use Needs Review instead. labels Jun 6, 2024
@fgiannar fgiannar added [Status] Needs Review This PR is ready for review. and removed [Status] Ready to Merge Go ahead, you can push that green button! labels Jun 6, 2024
remove_action( 'customize_register', array( 'Jetpack_Fonts_Typekit', 'maybe_override_for_advanced_mode' ), 20 );

remove_action( 'customize_register', 'Automattic\Jetpack\Dashboard_Customizations\register_css_nudge_control' );
remove_action( 'customize_register', 'Automattic\Jetpack\Masterbar\register_css_nudge_control' );
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 is currently not working for Simple sites since we are still using the module code on WPCOM. We should probably add a class_exists here so that when we are on WPCOM (Simple sites) we keep using Automattic\Jetpack\Dashboard_Customizations\register_css_nudge_control, while on remote sites (self-hosted and WoA) we use Automattic\Jetpack\Masterbar\register_css_nudge_control

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done via 6aa5a1e

@fushar fushar dismissed their stale review June 6, 2024 12:04

Code updated

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.

Alright, tried to be more thorough this time (tested with Simple Classic, Simple Default, Atomic Classic, Atomic Default, Self-hosted with toolbar module enabled, and Self-hosted with toolbar module disabled) and everything seems to be working as expected for me.

Considering the number of scenarios and features to check, it'd be great if someone else could test this as well!

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.

Tested on Atomic, self-hosted and Simple. Everything works as expected now.
RTL actually works better from my tests on Atomic - the notification panel works there but doesn't on trunk, when RTL is enabled.

Copy link
Contributor

@bindlegirl bindlegirl left a comment

Choose a reason for hiding this comment

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

Tested and everything seems to be fine.

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 [Package] Masterbar [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants