From ebfa7d323cd6e440401488641b7830c5ac545cf3 Mon Sep 17 00:00:00 2001 From: arthur791004 Date: Thu, 18 Jul 2024 00:59:13 +0800 Subject: [PATCH] Admin Bar: Make it consistent between Calypso and WP Admin regardless of the value of Admin Interface Style (#38362) --- .../packages/jetpack-mu-wpcom/changelog/feat-unify-masterbar | 4 ++++ .../src/features/wpcom-admin-bar/wpcom-admin-bar.php | 4 +--- projects/packages/masterbar/changelog/feat-unify-masterbar | 4 ++++ projects/packages/masterbar/composer.json | 2 +- projects/packages/masterbar/package.json | 2 +- .../src/admin-color-schemes/class-admin-color-schemes.php | 2 +- .../masterbar/src/admin-menu/class-base-admin-menu.php | 4 ++-- projects/packages/masterbar/src/class-main.php | 4 ++-- projects/plugins/jetpack/changelog/feat-unify-masterbar | 5 +++++ projects/plugins/jetpack/composer.lock | 4 ++-- .../plugins/mu-wpcom-plugin/changelog/feat-unify-masterbar | 5 +++++ projects/plugins/mu-wpcom-plugin/composer.lock | 4 ++-- projects/plugins/wpcomsh/changelog/feat-unify-masterbar | 5 +++++ projects/plugins/wpcomsh/composer.lock | 4 ++-- 14 files changed, 37 insertions(+), 16 deletions(-) create mode 100644 projects/packages/jetpack-mu-wpcom/changelog/feat-unify-masterbar create mode 100644 projects/packages/masterbar/changelog/feat-unify-masterbar create mode 100644 projects/plugins/jetpack/changelog/feat-unify-masterbar create mode 100644 projects/plugins/mu-wpcom-plugin/changelog/feat-unify-masterbar create mode 100644 projects/plugins/wpcomsh/changelog/feat-unify-masterbar diff --git a/projects/packages/jetpack-mu-wpcom/changelog/feat-unify-masterbar b/projects/packages/jetpack-mu-wpcom/changelog/feat-unify-masterbar new file mode 100644 index 0000000000000..d4b1a1df72511 --- /dev/null +++ b/projects/packages/jetpack-mu-wpcom/changelog/feat-unify-masterbar @@ -0,0 +1,4 @@ +Significance: minor +Type: changed + +Admin Bar: Make it consistent between Calypso and WP Admin regardless of the value of Admin Interface Style diff --git a/projects/packages/jetpack-mu-wpcom/src/features/wpcom-admin-bar/wpcom-admin-bar.php b/projects/packages/jetpack-mu-wpcom/src/features/wpcom-admin-bar/wpcom-admin-bar.php index 7edefbba95a1d..67034c150207c 100644 --- a/projects/packages/jetpack-mu-wpcom/src/features/wpcom-admin-bar/wpcom-admin-bar.php +++ b/projects/packages/jetpack-mu-wpcom/src/features/wpcom-admin-bar/wpcom-admin-bar.php @@ -9,9 +9,7 @@ use Automattic\Jetpack\Jetpack_Mu_Wpcom; -if ( get_option( 'wpcom_admin_interface' ) !== 'wp-admin' ) { - return; -} +define( 'WPCOM_ADMIN_BAR_UNIFICATION', true ); /** * Enqueue assets needed by the WordPress.com admin bar. diff --git a/projects/packages/masterbar/changelog/feat-unify-masterbar b/projects/packages/masterbar/changelog/feat-unify-masterbar new file mode 100644 index 0000000000000..d4b1a1df72511 --- /dev/null +++ b/projects/packages/masterbar/changelog/feat-unify-masterbar @@ -0,0 +1,4 @@ +Significance: minor +Type: changed + +Admin Bar: Make it consistent between Calypso and WP Admin regardless of the value of Admin Interface Style diff --git a/projects/packages/masterbar/composer.json b/projects/packages/masterbar/composer.json index 1fe51f0f329bd..e2cbf86669f9e 100644 --- a/projects/packages/masterbar/composer.json +++ b/projects/packages/masterbar/composer.json @@ -63,7 +63,7 @@ "extra": { "autotagger": true, "branch-alias": { - "dev-trunk": "0.3.x-dev" + "dev-trunk": "0.4.x-dev" }, "changelogger": { "link-template": "https://github.com/Automattic/jetpack-masterbar/compare/v${old}...v${new}" diff --git a/projects/packages/masterbar/package.json b/projects/packages/masterbar/package.json index 3ad06a70ef3c1..ab1c27242d3a0 100644 --- a/projects/packages/masterbar/package.json +++ b/projects/packages/masterbar/package.json @@ -1,7 +1,7 @@ { "private": true, "name": "@automattic/jetpack-masterbar", - "version": "0.3.1", + "version": "0.4.0-alpha", "description": "The WordPress.com Toolbar feature replaces the default admin bar and offers quick links to the Reader, all your sites, your WordPress.com profile, and notifications.", "homepage": "https://github.com/Automattic/jetpack/tree/HEAD/projects/packages/masterbar/#readme", "bugs": { diff --git a/projects/packages/masterbar/src/admin-color-schemes/class-admin-color-schemes.php b/projects/packages/masterbar/src/admin-color-schemes/class-admin-color-schemes.php index 5e3edd926a915..42a9c0f32fa78 100644 --- a/projects/packages/masterbar/src/admin-color-schemes/class-admin-color-schemes.php +++ b/projects/packages/masterbar/src/admin-color-schemes/class-admin-color-schemes.php @@ -32,7 +32,7 @@ public function __construct() { add_action( 'rest_api_init', array( $this, 'register_admin_color_meta' ) ); } - if ( get_option( 'wpcom_admin_interface' ) === 'wp-admin' ) { // Classic sites. + if ( ( defined( 'WPCOM_ADMIN_BAR_UNIFICATION' ) && WPCOM_ADMIN_BAR_UNIFICATION ) || get_option( 'wpcom_admin_interface' ) === 'wp-admin' ) { // Classic sites. add_filter( 'css_do_concat', array( $this, 'disable_css_concat_for_color_schemes' ), 10, 2 ); add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_color_scheme_for_sidebar_notice' ) ); } else { // Default and self-hosted sites. diff --git a/projects/packages/masterbar/src/admin-menu/class-base-admin-menu.php b/projects/packages/masterbar/src/admin-menu/class-base-admin-menu.php index 2b638b8159073..0a82ee4ac89fa 100644 --- a/projects/packages/masterbar/src/admin-menu/class-base-admin-menu.php +++ b/projects/packages/masterbar/src/admin-menu/class-base-admin-menu.php @@ -276,8 +276,8 @@ public function enqueue_scripts() { ) ); - // Load nav unification styles when the user isn't using wp-admin interface style. - if ( ! $this->use_wp_admin_interface() ) { + // Load nav unification styles for the admin bar when the user isn't using wp-admin interface style. + if ( ! $this->use_wp_admin_interface() && ! ( defined( 'WPCOM_ADMIN_BAR_UNIFICATION' ) && WPCOM_ADMIN_BAR_UNIFICATION ) ) { Assets::register_script( 'jetpack-admin-nav-unification', $assets_base_path . 'admin-menu-nav-unification.js', diff --git a/projects/packages/masterbar/src/class-main.php b/projects/packages/masterbar/src/class-main.php index 078111fcb5d93..db738fc5f55a2 100644 --- a/projects/packages/masterbar/src/class-main.php +++ b/projects/packages/masterbar/src/class-main.php @@ -14,7 +14,7 @@ */ class Main { - const PACKAGE_VERSION = '0.3.1'; + const PACKAGE_VERSION = '0.4.0-alpha'; /** * Initializer. @@ -29,7 +29,7 @@ public static function init() { new Admin_Color_Schemes(); - if ( get_option( 'wpcom_admin_interface' ) === 'wp-admin' ) { + if ( ( defined( 'WPCOM_ADMIN_BAR_UNIFICATION' ) && WPCOM_ADMIN_BAR_UNIFICATION ) || get_option( 'wpcom_admin_interface' ) === 'wp-admin' ) { return; } diff --git a/projects/plugins/jetpack/changelog/feat-unify-masterbar b/projects/plugins/jetpack/changelog/feat-unify-masterbar new file mode 100644 index 0000000000000..a1c1831fa1ef7 --- /dev/null +++ b/projects/plugins/jetpack/changelog/feat-unify-masterbar @@ -0,0 +1,5 @@ +Significance: patch +Type: other +Comment: Updated composer.lock. + + diff --git a/projects/plugins/jetpack/composer.lock b/projects/plugins/jetpack/composer.lock index 9d153dcda4aa0..3eed656c37093 100644 --- a/projects/plugins/jetpack/composer.lock +++ b/projects/plugins/jetpack/composer.lock @@ -1661,7 +1661,7 @@ "dist": { "type": "path", "url": "../../packages/masterbar", - "reference": "6425113a40fc707923278fa64aeb59aac96f1c3e" + "reference": "7eb8932228fd440df85d5459043a7203adf08e35" }, "require": { "automattic/jetpack-assets": "@dev", @@ -1689,7 +1689,7 @@ "extra": { "autotagger": true, "branch-alias": { - "dev-trunk": "0.3.x-dev" + "dev-trunk": "0.4.x-dev" }, "changelogger": { "link-template": "https://github.com/Automattic/jetpack-masterbar/compare/v${old}...v${new}" diff --git a/projects/plugins/mu-wpcom-plugin/changelog/feat-unify-masterbar b/projects/plugins/mu-wpcom-plugin/changelog/feat-unify-masterbar new file mode 100644 index 0000000000000..9aa70e3ec1f75 --- /dev/null +++ b/projects/plugins/mu-wpcom-plugin/changelog/feat-unify-masterbar @@ -0,0 +1,5 @@ +Significance: patch +Type: changed +Comment: Updated composer.lock. + + diff --git a/projects/plugins/mu-wpcom-plugin/composer.lock b/projects/plugins/mu-wpcom-plugin/composer.lock index c91bb09395b7c..fe27908d1c6f7 100644 --- a/projects/plugins/mu-wpcom-plugin/composer.lock +++ b/projects/plugins/mu-wpcom-plugin/composer.lock @@ -926,7 +926,7 @@ "dist": { "type": "path", "url": "../../packages/masterbar", - "reference": "6425113a40fc707923278fa64aeb59aac96f1c3e" + "reference": "7eb8932228fd440df85d5459043a7203adf08e35" }, "require": { "automattic/jetpack-assets": "@dev", @@ -954,7 +954,7 @@ "extra": { "autotagger": true, "branch-alias": { - "dev-trunk": "0.3.x-dev" + "dev-trunk": "0.4.x-dev" }, "changelogger": { "link-template": "https://github.com/Automattic/jetpack-masterbar/compare/v${old}...v${new}" diff --git a/projects/plugins/wpcomsh/changelog/feat-unify-masterbar b/projects/plugins/wpcomsh/changelog/feat-unify-masterbar new file mode 100644 index 0000000000000..9aa70e3ec1f75 --- /dev/null +++ b/projects/plugins/wpcomsh/changelog/feat-unify-masterbar @@ -0,0 +1,5 @@ +Significance: patch +Type: changed +Comment: Updated composer.lock. + + diff --git a/projects/plugins/wpcomsh/composer.lock b/projects/plugins/wpcomsh/composer.lock index ea894c030f6a4..cd77f47d65202 100644 --- a/projects/plugins/wpcomsh/composer.lock +++ b/projects/plugins/wpcomsh/composer.lock @@ -1063,7 +1063,7 @@ "dist": { "type": "path", "url": "../../packages/masterbar", - "reference": "6425113a40fc707923278fa64aeb59aac96f1c3e" + "reference": "7eb8932228fd440df85d5459043a7203adf08e35" }, "require": { "automattic/jetpack-assets": "@dev", @@ -1091,7 +1091,7 @@ "extra": { "autotagger": true, "branch-alias": { - "dev-trunk": "0.3.x-dev" + "dev-trunk": "0.4.x-dev" }, "changelogger": { "link-template": "https://github.com/Automattic/jetpack-masterbar/compare/v${old}...v${new}"