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

Admin menu: Change order of Jetpack sub-menu items #39095

Merged
merged 10 commits into from
Aug 28, 2024

Conversation

coder-karen
Copy link
Contributor

@coder-karen coder-karen commented Aug 27, 2024

Fixes https://github.com/Automattic/jetpack-roadmap/issues/856

Continuation of #38768

Proposed changes:

View the order of items here My Jetpack
Stats
Boost
VideoPress
Social
Protect
Akismet Anti-spam
VaultPress Backup
Activity Log (External)
Scan
Search
Subscribers (External)
WordAds
Settings
Dashboard
Jetpack Manage (External)
Beta Tester
  • This PR also updates the logic to ensure that Dashboard, Settings, and Activity Log items are shown as selected, when the relevant dashboard pages are open.
  • Other Jetpack menu items apart from those mentioned above haven't been considered here, for example Monetize on WoA sites.
  • Also, ideally we'd add tests here, particularly for jetpackPageOrder (ensuring the correct menu item is showing as selected). Since there is a level of urgency in getting this change out I'll follow up separately: https://github.com/Automattic/vulcan/issues/482
  • Simple sites have their own order defined, see also add_jetpack_submenu in mu-plugins/jetpack-newsletter.php

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

See https://github.com/Automattic/jetpack-roadmap/issues/856

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

No.

Testing instructions:

This is relevant for self-hosted and WoA sites - Simple sites override menu locations.

  • With this PR applied, you should be able to see Jetpack menu items in the same order as explained under Proposed Changes above.
  • The Dashboard and Settings menu items should show as selected when clicked, regardless of the number of menu items before or after them.
  • To test with all menu items, note that Scan can be added by adding a Scan plan (and ensure Scan is working on the site) and deactivating Protect. WordAds can be added by including define( 'ENABLE_WORDADS_SHARED_UI', true ); in your wp-config.php file. Subscribers will be added if you enable the Newsletter feature at /wp-admin/admin.php?page=jetpack#/newsletter. I found the best way to add the other items if not testing locally is using the Jetpack Beta tester plugin, then activating all relevant plugins. However as Akismet is not included with the Beta tester plugin, you'd have to apply the branch for a plugin that uses the admin-ui package, which is most (eg. Jetpack, Beta plugin, Boost..).
  • You'll also want to test without Jetpack installed as well, and just some standalones instead. If testing on Jurassic Ninja or WoA, using the Beta tester plugin is the best way to do this as well, as you'll need to ensure you're applying this branch to the relevant standalone to make sure the menu priority is up to date - including Jetpack Beta itself.

Copy link
Contributor

github-actions bot commented Aug 27, 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/jetpack-menu-item-order 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/jetpack-menu-item-order
    
    bin/jetpack-downloader test jetpack-mu-wpcom-plugin update/jetpack-menu-item-order
    

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] Scan [Package] Ad aka WordAds [Package] Admin Ui [Package] Backup [Package] My Jetpack [Package] Search Contains core Search functionality for Jetpack and Search plugins [Package] VideoPress [Plugin] Beta For serving live branches and the beta versions. https://github.com/automattic/jetpack-beta [Plugin] Boost A feature to speed up the site and improve performance. [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ [Plugin] Protect A plugin with features to protect a site: brute force protection, security scanning, and a WAF. [Plugin] Social Issues about the Jetpack Social plugin Admin Page React-powered dashboard under the Jetpack menu labels Aug 27, 2024
Copy link
Contributor

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.


Follow this PR Review Process:

  1. Ensure all required checks appearing at the bottom of this PR are passing.
  2. Choose a review path based on your changes:
    • A. Team Review: add the "[Status] Needs Team Review" label
      • For most changes, including minor cross-team impacts.
      • Example: Updating a team-specific component or a small change to a shared library.
    • B. Crew Review: add the "[Status] Needs Review" label
      • For significant changes to core functionality.
      • Example: Major updates to a shared library or complex features.
    • C. Both: Start with Team, then request Crew
      • For complex changes or when you need extra confidence.
      • Example: Refactor affecting multiple systems.
  3. Get at least one approval before merging.

Still unsure? Reach out in #jetpack-developers for guidance!


Beta plugin:

  • Next scheduled release: none scheduled.

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


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 September 3, 2024 (scheduled code freeze on September 2, 2024).

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


Boost plugin:

  • Next scheduled release: none scheduled.

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


Social plugin:

  • Next scheduled release: none scheduled.

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


Protect plugin:

  • Next scheduled release: none scheduled.

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

@@ -64,6 +64,7 @@ private function __construct() {

add_action( 'admin_init', array( $jetpack_react, 'react_redirects' ), 0 );
add_action( 'admin_menu', array( $jetpack_react, 'add_actions' ), 998 );
add_action( 'admin_menu', array( $jetpack_react, 'remove_jetpack_menu' ), 2000 );
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 line and the relevant function borrowed from #38768.
The priority has been changed to 2000 though as the Jetpack menu item was still appearing on JN test sites.

Comment on lines +985 to +986
key: 'activityLog',
pattern: 'https://jetpack.com/redirect/?source=cloud-activity-log-wp-menu',
Copy link
Contributor Author

Choose a reason for hiding this comment

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

It seems to me this isn't needed, as I don't see how we'd be able to see the Activity Log menu item as a selected item, since it is an external link. Leaving for now to ensure I'm not introducing any bugs but this can also be removed if there is no known reason to keep it.

@coder-karen coder-karen added this to the jetpack/13.8 milestone Aug 27, 2024
@coder-karen coder-karen marked this pull request as ready for review August 27, 2024 12:43
@coder-karen coder-karen requested review from jeherve and a team August 27, 2024 12:55
@coder-karen coder-karen added [Status] Needs Review To request a review from fellow Jetpack developers. Label will be renamed soon. and removed [Status] Needs Team Review labels Aug 28, 2024
Copy link
Member

@jeherve jeherve 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 single and on multisite., and on WoA Nice work!

I keep finding it weird to have "Settings" before "Dashboard", and at the very end of the list, but I suppose I'll get used to it!

@jeherve jeherve added [Status] Ready to Merge Go ahead, you can push that green button! and removed [Status] Needs Review To request a review from fellow Jetpack developers. Label will be renamed soon. labels Aug 28, 2024
@coder-karen coder-karen merged commit f04351b into trunk Aug 28, 2024
75 checks passed
@coder-karen coder-karen deleted the update/jetpack-menu-item-order branch August 28, 2024 15:01
@github-actions github-actions bot removed the [Status] Ready to Merge Go ahead, you can push that green button! label Aug 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Admin Page React-powered dashboard under the Jetpack menu [Feature] Scan [Package] Ad aka WordAds [Package] Admin Ui [Package] Backup [Package] My Jetpack [Package] Search Contains core Search functionality for Jetpack and Search plugins [Package] VideoPress [Plugin] Beta For serving live branches and the beta versions. https://github.com/automattic/jetpack-beta [Plugin] Boost A feature to speed up the site and improve performance. [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ [Plugin] Protect A plugin with features to protect a site: brute force protection, security scanning, and a WAF. [Plugin] Social Issues about the Jetpack Social plugin
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants