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 Bar: Replace the wp-admin url with the calypso ones for the default interface #38377

Merged
merged 11 commits into from
Jul 19, 2024

Conversation

arthur791004
Copy link
Contributor

@arthur791004 arthur791004 commented Jul 17, 2024

Fixes https://github.com/Automattic/dotcom-forge/issues/8333

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

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

Testing instructions:

  • Go to /wp-admin on your site with the default admin interface
  • Make sure the URLs are replaced with the Calypso ones as much as possible
  • Go to Jetpack -> Settings -> Writing -> Custom Content Types, and enable both Testimonials and Portfolios
  • Make sure the following URLs point to Calypso
    • +New -> Project (Portfolios)
    • +New -> Testimonials
  • Here are URLs that keep the same
    • Widgets - /wp-admin/widgets.php
    • Menu - /wp-admin/nav-menus.php
    • Jetpack Stats on atomic frontend page - /wp-admin/admin.php?page=stats&noheader&proxy&chart=admin-bar-hours-scale
    • Edit comment icon on p2 - /wp-admin/edit-comments.php
    • Customize - /wp-admin/customize.php?url=%your_site%
    • Manage Site - https://wordpress.com/wp-admin/network/site-info.php?id=%your_site_id%
  • Check the Menu toggle on Default atomic sites with mobile view.

Copy link
Contributor

github-actions bot commented Jul 17, 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 feat/unify-masterbar-calypso-url 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-mu-wpcom-plugin feat/unify-masterbar-calypso-url
    

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 Jul 17, 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 August 6, 2024 (scheduled code freeze on August 5, 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: 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.


Wpcomsh 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.

@github-actions github-actions bot added the [Status] Needs Author Reply We would need you to make some changes or provide some more details about your PR. Thank you! label Jul 17, 2024
Base automatically changed from feat/unify-masterbar to trunk July 17, 2024 16:59
@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/ [Plugin] mu wpcom jetpack-mu-wpcom plugin [Plugin] Wpcomsh labels Jul 17, 2024
@arthur791004 arthur791004 force-pushed the feat/unify-masterbar-calypso-url branch from d0f37ea to c8794ec Compare July 18, 2024 08:46
@arthur791004 arthur791004 changed the base branch from trunk to feat/unify-masterbar-2 July 18, 2024 08:46
Copy link
Contributor

@fushar fushar left a comment

Choose a reason for hiding this comment

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

We also need the following:

  • wp-admin/post-new.php?post_type=jetpack-testimonial => https://wordpress.com/types/jetpack-testimonial/%home_url%
  • wp-admin/post-new.php?post_type=jetpack-portfolio => https://wordpress.com/types/jetpack-portfolio/%home_url%

Base automatically changed from feat/unify-masterbar-2 to trunk July 18, 2024 11:00
@arthur791004
Copy link
Contributor Author

wp-admin/post-new.php?post_type=jetpack-testimonial => https://wordpress.com/types/jetpack-testimonial/%home_url%
wp-admin/post-new.php?post_type=jetpack-portfolio => https://wordpress.com/types/jetpack-portfolio/%home_url%

Where are these 2 items?

@fushar
Copy link
Contributor

fushar commented Jul 18, 2024

Where are these 2 items?

Ah sorry, you need to enable them on Jetpack -> Settings -> Writing -> Custom Content Types first.

image

@arthur791004 arthur791004 force-pushed the feat/unify-masterbar-calypso-url branch from c8794ec to c645802 Compare July 18, 2024 11:11
@arthur791004 arthur791004 self-assigned this Jul 18, 2024
@arthur791004 arthur791004 added [Status] Needs Team Review 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 Jul 18, 2024
@arthur791004 arthur791004 requested review from a team July 18, 2024 11:14
return;
}

$host = new Host();

if ( ! $host->is_wpcom_simple() ) {
if ( ! $host->is_wpcom_simple() && ! ( defined( 'WPCOM_ADMIN_BAR_UNIFICATION' ) && WPCOM_ADMIN_BAR_UNIFICATION ) ) {
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'm unsure but it seems to be okay to just disable Masterbar if WPCOM_ADMIN_BAR_UNIFICATION is enabled

if ( class_exists( '\Automattic\Jetpack\Status\Host' ) && ( new \Automattic\Jetpack\Status\Host() )->is_woa_site() ) {
\Automattic\Jetpack\Calypsoify\Jetpack_Calypsoify::get_instance();
// This is temporary. After we cleanup Masterbar on WPCOM we should load Masterbar for Simple sites too.
\Automattic\Jetpack\Masterbar\Main::init();
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 assume these 2 are wpcom user features, right 🤔

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, but I didn't want to make too many changes in the last PR (#38364)

Are this changes really necessary here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

At least it should be called after the flag defined.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ohhhhhh.... I seee....

Copy link
Contributor

@fushar fushar 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 I believe it works.

fushar
fushar previously requested changes Jul 18, 2024
Copy link
Contributor

@fushar fushar left a comment

Choose a reason for hiding this comment

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

This causes fatal error in WPCOM 🥲

Fatal error: Cannot redeclare wpcom_custom_admin_bar_class() (previously declared in <redacted>/admin-bar.php:109)

@fushar fushar dismissed their stale review July 18, 2024 14:01

Pushed potential fix

@fushar fushar force-pushed the feat/unify-masterbar-calypso-url branch from f377e61 to dcd0472 Compare July 18, 2024 14:06
fushar
fushar previously approved these changes Jul 18, 2024
Copy link
Contributor

@fushar fushar left a comment

Choose a reason for hiding this comment

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

Retested and it looks good on Atomic/Simple, Default/Classic, admin/frontend.

@fushar
Copy link
Contributor

fushar commented Jul 19, 2024

@lupus2k The W menu is not working on:

  • Atomic,
  • Default,
  • on site frontend,
  • in mobile viewport.

I think I'm gonna revert all changes not related to + New button from this PR and move them to another one. It's getting confusing now...

@fushar fushar force-pushed the feat/unify-masterbar-calypso-url branch from fdf9000 to fe4cc44 Compare July 19, 2024 02:12
@fushar fushar merged commit 02ec5c1 into trunk Jul 19, 2024
55 of 56 checks passed
@fushar fushar deleted the feat/unify-masterbar-calypso-url branch July 19, 2024 02:36
@fushar
Copy link
Contributor

fushar commented Jul 19, 2024

@lupus2k , @arthur791004 : I've ported the masterbar unification fix to a new PR: #38419.

@Addison-Stavlo
Copy link
Contributor

It looks like this added file threw fatals when jetpack released today. Wpcomsh is pinned at 4.0.0 now (which includes the jetpack-mu version it loads) until resolved - p1721840686641099-slack-C06DN6QQVAQ and p1721843060452409-slack-C06DN6QQVAQ

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] Wpcom Admin Bar [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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants