From c613f50c302a13b6093acd36c7da87f079fceefb Mon Sep 17 00:00:00 2001 From: Foteini Giannaropoulou Date: Wed, 12 Jun 2024 14:43:02 +0300 Subject: [PATCH 01/15] Masterbar: Require and use 'jetpack-masterbar' pkg in jetpack-mu-wpcom --- .../packages/jetpack-mu-wpcom/composer.json | 1 + .../src/class-jetpack-mu-wpcom.php | 5 +- .../admin-color-schemes.php | 172 +----------------- .../class-admin-color-schemes.php | 45 ++++- .../packages/masterbar/src/class-main.php | 10 +- .../php/test-class-admin-color-schemes.php | 2 + 6 files changed, 61 insertions(+), 174 deletions(-) diff --git a/projects/packages/jetpack-mu-wpcom/composer.json b/projects/packages/jetpack-mu-wpcom/composer.json index b38166b2eb2f5..68ab895329538 100644 --- a/projects/packages/jetpack-mu-wpcom/composer.json +++ b/projects/packages/jetpack-mu-wpcom/composer.json @@ -10,6 +10,7 @@ "automattic/jetpack-calypsoify": "@dev", "automattic/jetpack-classic-theme-helper": "@dev", "automattic/jetpack-connection": "@dev", + "automattic/jetpack-masterbar": "@dev", "automattic/jetpack-redirect": "@dev", "automattic/jetpack-stats-admin": "@dev", "automattic/jetpack-status": "@dev", diff --git a/projects/packages/jetpack-mu-wpcom/src/class-jetpack-mu-wpcom.php b/projects/packages/jetpack-mu-wpcom/src/class-jetpack-mu-wpcom.php index 2cf91a6d90ca1..d23570b2a58c5 100644 --- a/projects/packages/jetpack-mu-wpcom/src/class-jetpack-mu-wpcom.php +++ b/projects/packages/jetpack-mu-wpcom/src/class-jetpack-mu-wpcom.php @@ -77,7 +77,6 @@ public static function load_features() { // Please keep the features in alphabetical order. require_once __DIR__ . '/features/100-year-plan/enhanced-ownership.php'; require_once __DIR__ . '/features/100-year-plan/locked-mode.php'; - require_once __DIR__ . '/features/admin-color-schemes/admin-color-schemes.php'; require_once __DIR__ . '/features/block-patterns/block-patterns.php'; require_once __DIR__ . '/features/blog-privacy/blog-privacy.php'; require_once __DIR__ . '/features/cloudflare-analytics/cloudflare-analytics.php'; @@ -94,9 +93,11 @@ public static function load_features() { // Initializers, if needed. \Marketplace_Products_Updater::init(); - // Only load the Calypsoify feature on WoA sites. + // Only load the Calypsoify and Masterbar features on WoA sites. 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(); } // Gets autoloaded from the Scheduled_Updates package. if ( class_exists( 'Automattic\Jetpack\Scheduled_Updates' ) ) { diff --git a/projects/packages/jetpack-mu-wpcom/src/features/admin-color-schemes/admin-color-schemes.php b/projects/packages/jetpack-mu-wpcom/src/features/admin-color-schemes/admin-color-schemes.php index b37d332e3dabd..93f3950ceceb2 100644 --- a/projects/packages/jetpack-mu-wpcom/src/features/admin-color-schemes/admin-color-schemes.php +++ b/projects/packages/jetpack-mu-wpcom/src/features/admin-color-schemes/admin-color-schemes.php @@ -2,173 +2,15 @@ /** * Additional admin color schemes. * - * The content of this file is mostly copied from projects/plugins/jetpack/modules/masterbar/admin-color-schemes/class-admin-color-schemes.php. - * * @package automattic/jetpack-mu-wpcom */ -use Automattic\Jetpack\Jetpack_Mu_Wpcom; - -/** - * Get the admin color scheme URL based on the environment - * - * @param string $color_scheme The color scheme to get the URL for. - * @param string $file The file name (optional, default: colors.css). - * @return string - */ -function get_admin_color_scheme_url( $color_scheme, $file = 'colors.css' ) { - // TODO: migrate these color scheme CSS files to jetpack-mu-wpcom as well. - return plugins_url( '_inc/build/masterbar/admin-color-schemes/colors/' . $color_scheme . '/' . $file, JETPACK__PLUGIN_FILE ); -} - -/** - * Registers Calypso admin color schemes. - */ -function register_calypso_admin_color_schemes() { - wp_admin_css_color( - 'aquatic', - __( 'Aquatic', 'jetpack-mu-wpcom' ), - get_admin_color_scheme_url( 'aquatic' ), - array( '#135e96', '#007e65', '#043959', '#c5d9ed' ), - array( - 'base' => '#c5d9ed', - 'focus' => '#fff', - 'current' => '#01263a', - ) - ); - - wp_admin_css_color( - 'classic-blue', - __( 'Classic Blue', 'jetpack-mu-wpcom' ), - get_admin_color_scheme_url( 'classic-blue' ), - array( '#135e96', '#b26200', '#dcdcde', '#646970' ), - array( - 'base' => '#646970', - 'focus' => '#2271b1', - 'current' => '#fff', - ) - ); - - wp_admin_css_color( - 'classic-bright', - __( 'Classic Bright', 'jetpack-mu-wpcom' ), - get_admin_color_scheme_url( 'classic-bright' ), - array( '#135e96', '#c9256e', '#ffffff', '#e9eff5' ), - array( - 'base' => '#646970', - 'focus' => '#1d2327', - 'current' => '#0a4b78', - ) - ); - - wp_admin_css_color( - 'classic-dark', - __( 'Classic Dark', 'jetpack-mu-wpcom' ), - get_admin_color_scheme_url( 'classic-dark' ), - array( '#101517', '#c9356e', '#32373c', '#0073aa' ), - array( - 'base' => '#a2aab2', - 'focus' => '#00b9eb', - 'current' => '#fff', - ) - ); - - wp_admin_css_color( - 'contrast', - __( 'Contrast', 'jetpack-mu-wpcom' ), - get_admin_color_scheme_url( 'contrast' ), - array( '#101517', '#ffffff', '#32373c', '#b4b9be' ), - array( - 'base' => '#1d2327', - 'focus' => '#fff', - 'current' => '#fff', - ) - ); - - wp_admin_css_color( - 'nightfall', - __( 'Nightfall', 'jetpack-mu-wpcom' ), - get_admin_color_scheme_url( 'nightfall' ), - array( '#00131c', '#043959', '#2271b1', '#9ec2e6' ), - array( - 'base' => '#9ec2e6', - 'focus' => '#fff', - 'current' => '#fff', - ) - ); - - wp_admin_css_color( - 'powder-snow', - __( 'Powder Snow', 'jetpack-mu-wpcom' ), - get_admin_color_scheme_url( 'powder-snow' ), - array( '#101517', '#2271b1', '#dcdcde', '#646970' ), - array( - 'base' => '#646970', - 'focus' => '#135e96', - 'current' => '#fff', - ) - ); - - wp_admin_css_color( - 'sakura', - __( 'Sakura', 'jetpack-mu-wpcom' ), - get_admin_color_scheme_url( 'sakura' ), - array( '#005042', '#f2ceda', '#2271b1', '#8c1749' ), - array( - 'base' => '#8c1749', - 'focus' => '#4f092a', - 'current' => '#fff', - ) - ); - - wp_admin_css_color( - 'sunset', - __( 'Sunset', 'jetpack-mu-wpcom' ), - get_admin_color_scheme_url( 'sunset' ), - array( '#691c1c', '#b26200', '#f0c930', '#facfd2' ), - array( - 'base' => '#facfd2', - 'focus' => '#fff', - 'current' => '#4f3500', - ) - ); -} - -/** - * Currently, the selected color scheme CSS (with id = "colors") is concatenated (by Jetpack Boost / Page Optimize), - * and is output before the default color scheme CSS, making it lose in specificity. - * - * To prevent this, we disable CSS concatenation for color schemes. - - * @param boolean $do_concat Whether to concat the CSS file. - * @param string $handle The file handle. - * @return boolean - */ -function disable_css_concat_for_color_schemes( $do_concat, $handle ) { - if ( $handle === 'colors' ) { - return false; - } - return $do_concat; -} - -/** - * For Core color schemes, we have an additional CSS file that is responsible for the colors of the sidebar notice. - */ -function enqueue_color_scheme_for_sidebar_notice() { - $core_color_schemes = array( 'blue', 'coffee', 'ectoplasm', 'fresh', 'light', 'midnight', 'modern', 'ocean', 'sunrise' ); - $color_scheme = get_user_option( 'admin_color' ); - if ( in_array( $color_scheme, $core_color_schemes, true ) ) { - wp_enqueue_style( - 'jetpack-core-color-schemes-overrides-sidebar-notice', - get_admin_color_scheme_url( $color_scheme, 'sidebar-notice.css' ), - array(), - Jetpack_Mu_Wpcom::PACKAGE_VERSION - ); - } -} +use Automattic\Jetpack\Masterbar\Admin_Color_Schemes; +use Automattic\Jetpack\Status\Host; -if ( defined( 'JETPACK__PLUGIN_FILE' ) && function_exists( 'wpcom_is_nav_redesign_enabled' ) && wpcom_is_nav_redesign_enabled() ) { - add_action( 'admin_init', 'register_calypso_admin_color_schemes' ); - add_action( 'admin_enqueue_scripts', 'enqueue_color_scheme_for_sidebar_notice' ); - add_filter( 'css_do_concat', 'disable_css_concat_for_color_schemes', 10, 2 ); +// @TODO Ideally we should remove this feature entirely and update Jetpack_Mu_Wpcom::load_features to initialize +// Masterbar for both WoA and Simple sites. +// This would require removing the relevant Masterbar code on WPCOM and rely on the package only. +if ( function_exists( 'wpcom_is_nav_redesign_enabled' ) && wpcom_is_nav_redesign_enabled() && ( new Host() )->is_wpcom_simple() ) { + new Admin_Color_Schemes(); } 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 ab72282ca5b01..11f8b8684901e 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 @@ -7,6 +7,8 @@ namespace Automattic\Jetpack\Masterbar; +use Automattic\Jetpack\Status\Host; + /** * Unifies admin color scheme selection across WP.com sites. */ @@ -16,9 +18,20 @@ class Admin_Color_Schemes { * Admin_Color_Schemes constructor. */ public function __construct() { + // We want to register the admin color schemes across all environments. add_action( 'admin_init', array( $this, 'register_admin_color_schemes' ) ); - add_action( 'rest_api_init', array( $this, 'register_admin_color_meta' ) ); - add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_core_color_schemes_overrides' ) ); + // We don't want to make the admin_color available in users REST API endpoint for Simple sites. + if ( false === ( new Host() )->is_wpcom_simple() ) { + add_action( 'rest_api_init', array( $this, 'register_admin_color_meta' ) ); + } + + if ( function_exists( 'wpcom_is_nav_redesign_enabled' ) && wpcom_is_nav_redesign_enabled() ) { + add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_core_color_schemes_overrides' ) ); + add_filter( 'css_do_concat', 'disable_css_concat_for_color_schemes', 10, 2 ); + } elseif ( false === ( new Host() )->is_wpcom_platform() ) { + // @todo Self-hosted sites. Remove this line when we disable the module for self-hosted. + add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_core_color_schemes_overrides' ) ); + } } /** @@ -56,10 +69,11 @@ public function update_admin_color_permissions_check( $allowed, $meta_key, $obje * Get the admin color scheme URL based on the environment * * @param string $color_scheme The color scheme to get the URL for. + * @param string $file The file name (optional, default: colors.css). * @return string */ - public function get_admin_color_scheme_url( $color_scheme ) { - return plugins_url( '../../dist/admin-color-schemes/colors/' . $color_scheme . '/colors.css', __FILE__ ); + public function get_admin_color_scheme_url( $color_scheme, $file = 'colors.css' ) { + return plugins_url( '../../dist/admin-color-schemes/colors/' . $color_scheme . '/' . $file, __FILE__ ); } /** @@ -189,6 +203,29 @@ public function enqueue_core_color_schemes_overrides() { array(), Main::PACKAGE_VERSION ); + wp_enqueue_style( + 'jetpack-core-color-schemes-overrides-sidebar-notice', + $this->get_admin_color_scheme_url( $color_scheme, 'sidebar-notice.css' ), + array(), + Main::PACKAGE_VERSION + ); + } + } + + /** + * Currently, the selected color scheme CSS (with id = "colors") is concatenated (by Jetpack Boost / Page Optimize), + * and is output before the default color scheme CSS, making it lose in specificity. + * + * To prevent this, we disable CSS concatenation for color schemes. + + * @param boolean $do_concat Whether to concat the CSS file. + * @param string $handle The file handle. + * @return boolean + */ + public function disable_css_concat_for_color_schemes( $do_concat, $handle ) { + if ( $handle === 'colors' ) { + return false; } + return $do_concat; } } diff --git a/projects/packages/masterbar/src/class-main.php b/projects/packages/masterbar/src/class-main.php index bf692aab67204..3177d9dc7365d 100644 --- a/projects/packages/masterbar/src/class-main.php +++ b/projects/packages/masterbar/src/class-main.php @@ -27,21 +27,25 @@ public static function init() { return; } + $host = new Host(); $should_use_nav_redesign = function_exists( 'wpcom_is_nav_redesign_enabled' ) && wpcom_is_nav_redesign_enabled(); - if ( ! $should_use_nav_redesign ) { + if ( ! $should_use_nav_redesign && ! $host->is_wpcom_simple() ) { new Masterbar(); } new Admin_Color_Schemes(); - if ( ( new Host() )->is_woa_site() ) { + if ( $host->is_wpcom_platform() ) { new Inline_Help(); require_once __DIR__ . '/wp-posts-list/bootstrap.php'; - require_once __DIR__ . '/profile-edit/bootstrap.php'; require_once __DIR__ . '/nudges/bootstrap.php'; } + if ( $host->is_woa_site() ) { + require_once __DIR__ . '/profile-edit/bootstrap.php'; + } + /** * Whether to load the admin menu functionality. * diff --git a/projects/packages/masterbar/tests/php/test-class-admin-color-schemes.php b/projects/packages/masterbar/tests/php/test-class-admin-color-schemes.php index d95a71a0d17ab..3bf46d852babb 100644 --- a/projects/packages/masterbar/tests/php/test-class-admin-color-schemes.php +++ b/projects/packages/masterbar/tests/php/test-class-admin-color-schemes.php @@ -158,7 +158,9 @@ public function test_enqueue_core_color_schemes_overrides() { update_user_option( static::$user_id, 'admin_color', 'coffee' ); set_current_screen( 'edit-post' ); $this->assertFalse( wp_style_is( 'jetpack-core-color-schemes-overrides' ) ); + $this->assertFalse( wp_style_is( 'jetpack-core-color-schemes-overrides-sidebar-notice' ) ); do_action( 'admin_enqueue_scripts' ); $this->assertTrue( wp_style_is( 'jetpack-core-color-schemes-overrides' ) ); + $this->assertTrue( wp_style_is( 'jetpack-core-color-schemes-overrides-sidebar-notice' ) ); } } From d05d396290dfe94c9d77c05121e11b14139e65c8 Mon Sep 17 00:00:00 2001 From: Foteini Giannaropoulou Date: Wed, 12 Jun 2024 14:46:36 +0300 Subject: [PATCH 02/15] changelog --- .../changelog/add-masterbar-package-to-jetpack-mu-wpcom | 4 ++++ .../changelog/add-masterbar-package-to-jetpack-mu-wpcom | 4 ++++ 2 files changed, 8 insertions(+) create mode 100644 projects/packages/jetpack-mu-wpcom/changelog/add-masterbar-package-to-jetpack-mu-wpcom create mode 100644 projects/packages/masterbar/changelog/add-masterbar-package-to-jetpack-mu-wpcom diff --git a/projects/packages/jetpack-mu-wpcom/changelog/add-masterbar-package-to-jetpack-mu-wpcom b/projects/packages/jetpack-mu-wpcom/changelog/add-masterbar-package-to-jetpack-mu-wpcom new file mode 100644 index 0000000000000..0ea2bf778513a --- /dev/null +++ b/projects/packages/jetpack-mu-wpcom/changelog/add-masterbar-package-to-jetpack-mu-wpcom @@ -0,0 +1,4 @@ +Significance: minor +Type: changed + +Masterbar: Require and use 'jetpack-masterbar' package in jetpack-mu-wpcom diff --git a/projects/packages/masterbar/changelog/add-masterbar-package-to-jetpack-mu-wpcom b/projects/packages/masterbar/changelog/add-masterbar-package-to-jetpack-mu-wpcom new file mode 100644 index 0000000000000..0ea2bf778513a --- /dev/null +++ b/projects/packages/masterbar/changelog/add-masterbar-package-to-jetpack-mu-wpcom @@ -0,0 +1,4 @@ +Significance: minor +Type: changed + +Masterbar: Require and use 'jetpack-masterbar' package in jetpack-mu-wpcom From b38dca8bec50ad005798befd0b1575018bb52900 Mon Sep 17 00:00:00 2001 From: Foteini Giannaropoulou Date: Wed, 12 Jun 2024 14:58:14 +0300 Subject: [PATCH 03/15] Update mu-wpcom-plugin/composer.lock --- .../plugins/mu-wpcom-plugin/composer.lock | 160 +++++++++++++++++- 1 file changed, 159 insertions(+), 1 deletion(-) diff --git a/projects/plugins/mu-wpcom-plugin/composer.lock b/projects/plugins/mu-wpcom-plugin/composer.lock index 7d4ee29e7990c..44aa9ca002703 100644 --- a/projects/plugins/mu-wpcom-plugin/composer.lock +++ b/projects/plugins/mu-wpcom-plugin/composer.lock @@ -184,6 +184,84 @@ "relative": true } }, + { + "name": "automattic/jetpack-blaze", + "version": "dev-trunk", + "dist": { + "type": "path", + "url": "../../packages/blaze", + "reference": "792f0dabc3e885b741dc4313f953fe2f4c29e978" + }, + "require": { + "automattic/jetpack-assets": "@dev", + "automattic/jetpack-connection": "@dev", + "automattic/jetpack-constants": "@dev", + "automattic/jetpack-plans": "@dev", + "automattic/jetpack-redirect": "@dev", + "automattic/jetpack-status": "@dev", + "automattic/jetpack-sync": "@dev", + "php": ">=7.0" + }, + "require-dev": { + "automattic/jetpack-changelogger": "@dev", + "automattic/wordbless": "@dev", + "yoast/phpunit-polyfills": "1.1.0" + }, + "suggest": { + "automattic/jetpack-autoloader": "Allow for better interoperability with other plugins that use this package." + }, + "type": "jetpack-library", + "extra": { + "autotagger": true, + "mirror-repo": "Automattic/jetpack-blaze", + "changelogger": { + "link-template": "https://github.com/automattic/jetpack-blaze/compare/v${old}...v${new}" + }, + "branch-alias": { + "dev-trunk": "0.21.x-dev" + }, + "textdomain": "jetpack-blaze", + "version-constants": { + "::PACKAGE_VERSION": "src/class-dashboard.php" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "scripts": { + "phpunit": [ + "./vendor/phpunit/phpunit/phpunit --colors=always" + ], + "test-php": [ + "@composer phpunit" + ], + "build-production": [ + "pnpm run build-production" + ], + "build-development": [ + "pnpm run build" + ], + "watch": [ + "Composer\\Config::disableProcessTimeout", + "pnpm run watch" + ], + "post-install-cmd": [ + "WorDBless\\Composer\\InstallDropin::copy" + ], + "post-update-cmd": [ + "WorDBless\\Composer\\InstallDropin::copy" + ] + }, + "license": [ + "GPL-2.0-or-later" + ], + "description": "Attract high-quality traffic to your site using Blaze.", + "transport-options": { + "relative": true + } + }, { "name": "automattic/jetpack-blocks", "version": "dev-trunk", @@ -774,13 +852,92 @@ "relative": true } }, + { + "name": "automattic/jetpack-masterbar", + "version": "dev-trunk", + "dist": { + "type": "path", + "url": "../../packages/masterbar", + "reference": "5f7ca0b1c441e446cf4b7c73c79e62301837af07" + }, + "require": { + "automattic/jetpack-assets": "@dev", + "automattic/jetpack-blaze": "@dev", + "automattic/jetpack-compat": "@dev", + "automattic/jetpack-connection": "@dev", + "automattic/jetpack-device-detection": "@dev", + "automattic/jetpack-jitm": "@dev", + "automattic/jetpack-logo": "@dev", + "automattic/jetpack-plans": "@dev", + "automattic/jetpack-status": "@dev", + "php": ">=7.0" + }, + "require-dev": { + "automattic/jetpack-changelogger": "@dev", + "automattic/patchwork-redefine-exit": "@dev", + "automattic/wordbless": "dev-master", + "brain/monkey": "2.6.1", + "yoast/phpunit-polyfills": "1.1.0" + }, + "suggest": { + "automattic/jetpack-autoloader": "Allow for better interoperability with other plugins that use this package." + }, + "type": "jetpack-library", + "extra": { + "autotagger": true, + "branch-alias": { + "dev-trunk": "0.1.x-dev" + }, + "changelogger": { + "link-template": "https://github.com/Automattic/jetpack-masterbar/compare/v${old}...v${new}" + }, + "mirror-repo": "Automattic/jetpack-masterbar", + "textdomain": "jetpack-masterbar", + "version-constants": { + "::PACKAGE_VERSION": "src/class-main.php" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "scripts": { + "build-production": [ + "pnpm run build-production" + ], + "build-development": [ + "pnpm run build" + ], + "phpunit": [ + "./vendor/phpunit/phpunit/phpunit --colors=always" + ], + "post-install-cmd": [ + "WorDBless\\Composer\\InstallDropin::copy" + ], + "post-update-cmd": [ + "WorDBless\\Composer\\InstallDropin::copy" + ], + "test-php": [ + "pnpm run build-production", + "@composer phpunit" + ] + }, + "license": [ + "GPL-2.0-or-later" + ], + "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.", + "transport-options": { + "relative": true + } + }, { "name": "automattic/jetpack-mu-wpcom", "version": "dev-trunk", "dist": { "type": "path", "url": "../../packages/jetpack-mu-wpcom", - "reference": "572557dc75d57d3d1a24aed00fc6cfbbf784f618" + "reference": "58a30d185808ca9b6438310e74a310015bf56335" }, "require": { "automattic/jetpack-assets": "@dev", @@ -789,6 +946,7 @@ "automattic/jetpack-classic-theme-helper": "@dev", "automattic/jetpack-compat": "@dev", "automattic/jetpack-connection": "@dev", + "automattic/jetpack-masterbar": "@dev", "automattic/jetpack-redirect": "@dev", "automattic/jetpack-stats-admin": "@dev", "automattic/jetpack-status": "@dev", From 6f5404769679d5034645e792a43d1e1b161f2496 Mon Sep 17 00:00:00 2001 From: Foteini Giannaropoulou Date: Wed, 12 Jun 2024 15:01:19 +0300 Subject: [PATCH 04/15] Fixup project versions --- projects/packages/jetpack-mu-wpcom/composer.json | 2 +- projects/packages/jetpack-mu-wpcom/package.json | 2 +- .../jetpack-mu-wpcom/src/class-jetpack-mu-wpcom.php | 2 +- projects/packages/masterbar/composer.json | 2 +- projects/packages/masterbar/package.json | 2 +- projects/packages/masterbar/src/class-main.php | 2 +- .../changelog/add-masterbar-package-to-jetpack-mu-wpcom | 5 +++++ projects/plugins/jetpack/composer.lock | 4 ++-- .../changelog/add-masterbar-package-to-jetpack-mu-wpcom | 5 +++++ projects/plugins/mu-wpcom-plugin/composer.lock | 8 ++++---- 10 files changed, 22 insertions(+), 12 deletions(-) create mode 100644 projects/plugins/jetpack/changelog/add-masterbar-package-to-jetpack-mu-wpcom create mode 100644 projects/plugins/mu-wpcom-plugin/changelog/add-masterbar-package-to-jetpack-mu-wpcom diff --git a/projects/packages/jetpack-mu-wpcom/composer.json b/projects/packages/jetpack-mu-wpcom/composer.json index 68ab895329538..aec08401b3d83 100644 --- a/projects/packages/jetpack-mu-wpcom/composer.json +++ b/projects/packages/jetpack-mu-wpcom/composer.json @@ -60,7 +60,7 @@ }, "autotagger": true, "branch-alias": { - "dev-trunk": "5.35.x-dev" + "dev-trunk": "5.36.x-dev" }, "textdomain": "jetpack-mu-wpcom", "version-constants": { diff --git a/projects/packages/jetpack-mu-wpcom/package.json b/projects/packages/jetpack-mu-wpcom/package.json index 36f3e21aeb450..5df725642b8af 100644 --- a/projects/packages/jetpack-mu-wpcom/package.json +++ b/projects/packages/jetpack-mu-wpcom/package.json @@ -1,7 +1,7 @@ { "private": true, "name": "@automattic/jetpack-mu-wpcom", - "version": "5.35.1-alpha", + "version": "5.36.0-alpha", "description": "Enhances your site with features powered by WordPress.com", "homepage": "https://github.com/Automattic/jetpack/tree/HEAD/projects/packages/jetpack-mu-wpcom/#readme", "bugs": { diff --git a/projects/packages/jetpack-mu-wpcom/src/class-jetpack-mu-wpcom.php b/projects/packages/jetpack-mu-wpcom/src/class-jetpack-mu-wpcom.php index 72d97fcd28f92..6d0b56018e6df 100644 --- a/projects/packages/jetpack-mu-wpcom/src/class-jetpack-mu-wpcom.php +++ b/projects/packages/jetpack-mu-wpcom/src/class-jetpack-mu-wpcom.php @@ -13,7 +13,7 @@ * Jetpack_Mu_Wpcom main class. */ class Jetpack_Mu_Wpcom { - const PACKAGE_VERSION = '5.35.1-alpha'; + const PACKAGE_VERSION = '5.36.0-alpha'; const PKG_DIR = __DIR__ . '/../'; const BASE_DIR = __DIR__ . '/'; const BASE_FILE = __FILE__; diff --git a/projects/packages/masterbar/composer.json b/projects/packages/masterbar/composer.json index 15a62ca4cf259..3fe6d0801a385 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.1.x-dev" + "dev-trunk": "0.2.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 55fc4f56a41b1..b83dd9ace32f7 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.1.1-alpha", + "version": "0.2.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/class-main.php b/projects/packages/masterbar/src/class-main.php index 7b9155b0d8f66..874c50d3f1100 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.1.1-alpha'; + const PACKAGE_VERSION = '0.2.0-alpha'; /** * Initializer. diff --git a/projects/plugins/jetpack/changelog/add-masterbar-package-to-jetpack-mu-wpcom b/projects/plugins/jetpack/changelog/add-masterbar-package-to-jetpack-mu-wpcom new file mode 100644 index 0000000000000..a1c1831fa1ef7 --- /dev/null +++ b/projects/plugins/jetpack/changelog/add-masterbar-package-to-jetpack-mu-wpcom @@ -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 558014d33bc07..9469bd39ea2da 100644 --- a/projects/plugins/jetpack/composer.lock +++ b/projects/plugins/jetpack/composer.lock @@ -1834,7 +1834,7 @@ "dist": { "type": "path", "url": "../../packages/masterbar", - "reference": "5f7ca0b1c441e446cf4b7c73c79e62301837af07" + "reference": "649e2a37061b3ccb7242a48423b1497e348a30de" }, "require": { "automattic/jetpack-assets": "@dev", @@ -1862,7 +1862,7 @@ "extra": { "autotagger": true, "branch-alias": { - "dev-trunk": "0.1.x-dev" + "dev-trunk": "0.2.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/add-masterbar-package-to-jetpack-mu-wpcom b/projects/plugins/mu-wpcom-plugin/changelog/add-masterbar-package-to-jetpack-mu-wpcom new file mode 100644 index 0000000000000..9aa70e3ec1f75 --- /dev/null +++ b/projects/plugins/mu-wpcom-plugin/changelog/add-masterbar-package-to-jetpack-mu-wpcom @@ -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 44aa9ca002703..3d4dcfe8c1dff 100644 --- a/projects/plugins/mu-wpcom-plugin/composer.lock +++ b/projects/plugins/mu-wpcom-plugin/composer.lock @@ -858,7 +858,7 @@ "dist": { "type": "path", "url": "../../packages/masterbar", - "reference": "5f7ca0b1c441e446cf4b7c73c79e62301837af07" + "reference": "649e2a37061b3ccb7242a48423b1497e348a30de" }, "require": { "automattic/jetpack-assets": "@dev", @@ -886,7 +886,7 @@ "extra": { "autotagger": true, "branch-alias": { - "dev-trunk": "0.1.x-dev" + "dev-trunk": "0.2.x-dev" }, "changelogger": { "link-template": "https://github.com/Automattic/jetpack-masterbar/compare/v${old}...v${new}" @@ -937,7 +937,7 @@ "dist": { "type": "path", "url": "../../packages/jetpack-mu-wpcom", - "reference": "58a30d185808ca9b6438310e74a310015bf56335" + "reference": "7ff93b7e86792a3647a0defcdffa63cf5c8fa97f" }, "require": { "automattic/jetpack-assets": "@dev", @@ -969,7 +969,7 @@ }, "autotagger": true, "branch-alias": { - "dev-trunk": "5.35.x-dev" + "dev-trunk": "5.36.x-dev" }, "textdomain": "jetpack-mu-wpcom", "version-constants": { From ca4ff2c0bc9a55e096fbf0df50c20d346350b030 Mon Sep 17 00:00:00 2001 From: Foteini Giannaropoulou Date: Wed, 12 Jun 2024 15:17:57 +0300 Subject: [PATCH 05/15] Update phan --- projects/packages/jetpack-mu-wpcom/.phan/baseline.php | 1 + .../src/admin-color-schemes/class-admin-color-schemes.php | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/projects/packages/jetpack-mu-wpcom/.phan/baseline.php b/projects/packages/jetpack-mu-wpcom/.phan/baseline.php index fc7b01b3b98c2..296b16b42e8ec 100644 --- a/projects/packages/jetpack-mu-wpcom/.phan/baseline.php +++ b/projects/packages/jetpack-mu-wpcom/.phan/baseline.php @@ -43,6 +43,7 @@ 'src/class-jetpack-mu-wpcom.php' => ['PhanNoopNew'], 'src/features/100-year-plan/enhanced-ownership.php' => ['PhanEmptyFQSENInCallable'], 'src/features/100-year-plan/locked-mode.php' => ['PhanEmptyFQSENInCallable'], + 'src/features/admin-color-schemes/admin-color-schemes.php' => ['PhanNoopNew'], 'src/features/block-patterns/class-wpcom-block-patterns-utils.php' => ['PhanTypeMismatchReturnNullable'], 'src/features/coming-soon/coming-soon.php' => ['PhanTypeArraySuspicious', 'PhanTypeMismatchArgumentInternal', 'PhanUndeclaredFunction'], 'src/features/coming-soon/fallback-coming-soon-page.php' => ['PhanTypeMismatchArgument', 'PhanTypeVoidArgument'], 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 11f8b8684901e..3560a2fe6a657 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 @@ -27,7 +27,7 @@ public function __construct() { if ( function_exists( 'wpcom_is_nav_redesign_enabled' ) && wpcom_is_nav_redesign_enabled() ) { add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_core_color_schemes_overrides' ) ); - add_filter( 'css_do_concat', 'disable_css_concat_for_color_schemes', 10, 2 ); + add_filter( 'css_do_concat', array( $this, 'disable_css_concat_for_color_schemes' ), 10, 2 ); } elseif ( false === ( new Host() )->is_wpcom_platform() ) { // @todo Self-hosted sites. Remove this line when we disable the module for self-hosted. add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_core_color_schemes_overrides' ) ); From e078c6aa648b9694046b306e825c0694d43bac6d Mon Sep 17 00:00:00 2001 From: Foteini Giannaropoulou Date: Wed, 12 Jun 2024 15:48:25 +0300 Subject: [PATCH 06/15] Hotfix: Add admin-color-schemes.php back to 'load_features' --- .../packages/jetpack-mu-wpcom/src/class-jetpack-mu-wpcom.php | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/packages/jetpack-mu-wpcom/src/class-jetpack-mu-wpcom.php b/projects/packages/jetpack-mu-wpcom/src/class-jetpack-mu-wpcom.php index 6d0b56018e6df..8ee7e27e4d3c9 100644 --- a/projects/packages/jetpack-mu-wpcom/src/class-jetpack-mu-wpcom.php +++ b/projects/packages/jetpack-mu-wpcom/src/class-jetpack-mu-wpcom.php @@ -77,6 +77,7 @@ public static function load_features() { // Please keep the features in alphabetical order. require_once __DIR__ . '/features/100-year-plan/enhanced-ownership.php'; require_once __DIR__ . '/features/100-year-plan/locked-mode.php'; + require_once __DIR__ . '/features/admin-color-schemes/admin-color-schemes.php'; require_once __DIR__ . '/features/block-patterns/block-patterns.php'; require_once __DIR__ . '/features/blog-privacy/blog-privacy.php'; require_once __DIR__ . '/features/cloudflare-analytics/cloudflare-analytics.php'; From d3728604543ee2fe1449236fc1d5cafbc4537171 Mon Sep 17 00:00:00 2001 From: Foteini Giannaropoulou Date: Thu, 13 Jun 2024 15:34:30 +0300 Subject: [PATCH 07/15] WPCOM_REST_API_V2_Endpoint_Admin_Menu: Be even more explicit and only require the masterbar file that loads the admin menu for self-hosted --- .../class-wpcom-rest-api-v2-endpoint-admin-menu.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/projects/plugins/jetpack/_inc/lib/core-api/wpcom-endpoints/class-wpcom-rest-api-v2-endpoint-admin-menu.php b/projects/plugins/jetpack/_inc/lib/core-api/wpcom-endpoints/class-wpcom-rest-api-v2-endpoint-admin-menu.php index b05b038ea6b1e..7fdf3e8bc2943 100644 --- a/projects/plugins/jetpack/_inc/lib/core-api/wpcom-endpoints/class-wpcom-rest-api-v2-endpoint-admin-menu.php +++ b/projects/plugins/jetpack/_inc/lib/core-api/wpcom-endpoints/class-wpcom-rest-api-v2-endpoint-admin-menu.php @@ -6,6 +6,8 @@ * @since 9.1.0 */ +use Automattic\Jetpack\Status\Host; + /** * Class WPCOM_REST_API_V2_Endpoint_Admin_Menu */ @@ -83,9 +85,8 @@ public function get_item_permissions_check( $request ) { // phpcs:ignore Generic * @return WP_REST_Response|WP_Error Response object on success, or WP_Error object on failure. */ public function get_item( $request ) { // phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter, VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable - $is_wpcom = defined( 'IS_WPCOM' ) && IS_WPCOM; $should_use_nav_redesign = function_exists( 'wpcom_is_nav_redesign_enabled' ) && wpcom_is_nav_redesign_enabled(); - if ( ! $is_wpcom && ! $should_use_nav_redesign ) { + if ( ! ( new Host() )->is_wpcom_platform() && ! $should_use_nav_redesign ) { require_once JETPACK__PLUGIN_DIR . 'jetpack_vendor/automattic/jetpack-masterbar/src/admin-menu/load.php'; } From d5296a37d6d6597ab2e13e0da77a51c1da44cc52 Mon Sep 17 00:00:00 2001 From: Foteini Giannaropoulou Date: Thu, 13 Jun 2024 16:33:12 +0300 Subject: [PATCH 08/15] Update wpcomsh composer.lock --- projects/plugins/wpcomsh/composer.lock | 162 ++++++++++++++++++++++++- 1 file changed, 160 insertions(+), 2 deletions(-) diff --git a/projects/plugins/wpcomsh/composer.lock b/projects/plugins/wpcomsh/composer.lock index f5883fd709b1a..6f547e415e874 100644 --- a/projects/plugins/wpcomsh/composer.lock +++ b/projects/plugins/wpcomsh/composer.lock @@ -245,6 +245,84 @@ "relative": true } }, + { + "name": "automattic/jetpack-blaze", + "version": "dev-trunk", + "dist": { + "type": "path", + "url": "../../packages/blaze", + "reference": "792f0dabc3e885b741dc4313f953fe2f4c29e978" + }, + "require": { + "automattic/jetpack-assets": "@dev", + "automattic/jetpack-connection": "@dev", + "automattic/jetpack-constants": "@dev", + "automattic/jetpack-plans": "@dev", + "automattic/jetpack-redirect": "@dev", + "automattic/jetpack-status": "@dev", + "automattic/jetpack-sync": "@dev", + "php": ">=7.0" + }, + "require-dev": { + "automattic/jetpack-changelogger": "@dev", + "automattic/wordbless": "@dev", + "yoast/phpunit-polyfills": "1.1.0" + }, + "suggest": { + "automattic/jetpack-autoloader": "Allow for better interoperability with other plugins that use this package." + }, + "type": "jetpack-library", + "extra": { + "autotagger": true, + "mirror-repo": "Automattic/jetpack-blaze", + "changelogger": { + "link-template": "https://github.com/automattic/jetpack-blaze/compare/v${old}...v${new}" + }, + "branch-alias": { + "dev-trunk": "0.21.x-dev" + }, + "textdomain": "jetpack-blaze", + "version-constants": { + "::PACKAGE_VERSION": "src/class-dashboard.php" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "scripts": { + "phpunit": [ + "./vendor/phpunit/phpunit/phpunit --colors=always" + ], + "test-php": [ + "@composer phpunit" + ], + "build-production": [ + "pnpm run build-production" + ], + "build-development": [ + "pnpm run build" + ], + "watch": [ + "Composer\\Config::disableProcessTimeout", + "pnpm run watch" + ], + "post-install-cmd": [ + "WorDBless\\Composer\\InstallDropin::copy" + ], + "post-update-cmd": [ + "WorDBless\\Composer\\InstallDropin::copy" + ] + }, + "license": [ + "GPL-2.0-or-later" + ], + "description": "Attract high-quality traffic to your site using Blaze.", + "transport-options": { + "relative": true + } + }, { "name": "automattic/jetpack-blocks", "version": "dev-trunk", @@ -908,13 +986,92 @@ "relative": true } }, + { + "name": "automattic/jetpack-masterbar", + "version": "dev-trunk", + "dist": { + "type": "path", + "url": "../../packages/masterbar", + "reference": "649e2a37061b3ccb7242a48423b1497e348a30de" + }, + "require": { + "automattic/jetpack-assets": "@dev", + "automattic/jetpack-blaze": "@dev", + "automattic/jetpack-compat": "@dev", + "automattic/jetpack-connection": "@dev", + "automattic/jetpack-device-detection": "@dev", + "automattic/jetpack-jitm": "@dev", + "automattic/jetpack-logo": "@dev", + "automattic/jetpack-plans": "@dev", + "automattic/jetpack-status": "@dev", + "php": ">=7.0" + }, + "require-dev": { + "automattic/jetpack-changelogger": "@dev", + "automattic/patchwork-redefine-exit": "@dev", + "automattic/wordbless": "dev-master", + "brain/monkey": "2.6.1", + "yoast/phpunit-polyfills": "1.1.0" + }, + "suggest": { + "automattic/jetpack-autoloader": "Allow for better interoperability with other plugins that use this package." + }, + "type": "jetpack-library", + "extra": { + "autotagger": true, + "branch-alias": { + "dev-trunk": "0.2.x-dev" + }, + "changelogger": { + "link-template": "https://github.com/Automattic/jetpack-masterbar/compare/v${old}...v${new}" + }, + "mirror-repo": "Automattic/jetpack-masterbar", + "textdomain": "jetpack-masterbar", + "version-constants": { + "::PACKAGE_VERSION": "src/class-main.php" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "scripts": { + "build-production": [ + "pnpm run build-production" + ], + "build-development": [ + "pnpm run build" + ], + "phpunit": [ + "./vendor/phpunit/phpunit/phpunit --colors=always" + ], + "post-install-cmd": [ + "WorDBless\\Composer\\InstallDropin::copy" + ], + "post-update-cmd": [ + "WorDBless\\Composer\\InstallDropin::copy" + ], + "test-php": [ + "pnpm run build-production", + "@composer phpunit" + ] + }, + "license": [ + "GPL-2.0-or-later" + ], + "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.", + "transport-options": { + "relative": true + } + }, { "name": "automattic/jetpack-mu-wpcom", "version": "dev-trunk", "dist": { "type": "path", "url": "../../packages/jetpack-mu-wpcom", - "reference": "572557dc75d57d3d1a24aed00fc6cfbbf784f618" + "reference": "7ff93b7e86792a3647a0defcdffa63cf5c8fa97f" }, "require": { "automattic/jetpack-assets": "@dev", @@ -923,6 +1080,7 @@ "automattic/jetpack-classic-theme-helper": "@dev", "automattic/jetpack-compat": "@dev", "automattic/jetpack-connection": "@dev", + "automattic/jetpack-masterbar": "@dev", "automattic/jetpack-redirect": "@dev", "automattic/jetpack-stats-admin": "@dev", "automattic/jetpack-status": "@dev", @@ -945,7 +1103,7 @@ }, "autotagger": true, "branch-alias": { - "dev-trunk": "5.35.x-dev" + "dev-trunk": "5.36.x-dev" }, "textdomain": "jetpack-mu-wpcom", "version-constants": { From c755a2115fb44d187a166008d42ff5cd6ee4f83e Mon Sep 17 00:00:00 2001 From: Foteini Giannaropoulou Date: Thu, 13 Jun 2024 16:38:01 +0300 Subject: [PATCH 09/15] changelog --- .../changelog/add-masterbar-package-to-jetpack-mu-wpcom | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 projects/plugins/wpcomsh/changelog/add-masterbar-package-to-jetpack-mu-wpcom diff --git a/projects/plugins/wpcomsh/changelog/add-masterbar-package-to-jetpack-mu-wpcom b/projects/plugins/wpcomsh/changelog/add-masterbar-package-to-jetpack-mu-wpcom new file mode 100644 index 0000000000000..2e93e6ae691b6 --- /dev/null +++ b/projects/plugins/wpcomsh/changelog/add-masterbar-package-to-jetpack-mu-wpcom @@ -0,0 +1,4 @@ +Significance: minor +Type: added + +Wpcomsh: Update plugin dependencies From 91fd9e27ada93a560a2d9653e372bd5f42a48c8e Mon Sep 17 00:00:00 2001 From: Foteini Giannaropoulou Date: Thu, 13 Jun 2024 16:42:25 +0300 Subject: [PATCH 10/15] Bump package versions --- projects/plugins/wpcomsh/composer.json | 2 +- projects/plugins/wpcomsh/package.json | 2 +- projects/plugins/wpcomsh/wpcomsh.php | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/projects/plugins/wpcomsh/composer.json b/projects/plugins/wpcomsh/composer.json index 71e16225143b2..e729e7e033923 100644 --- a/projects/plugins/wpcomsh/composer.json +++ b/projects/plugins/wpcomsh/composer.json @@ -125,7 +125,7 @@ "composer/installers": true, "roots/wordpress-core-installer": true }, - "autoloader-suffix": "26841ac2064774301cbe06d174833bfc_wpcomshⓥ3_22_6_alpha" + "autoloader-suffix": "26841ac2064774301cbe06d174833bfc_wpcomshⓥ3_23_0_alpha" }, "extra": { "mirror-repo": "Automattic/wpcom-site-helper", diff --git a/projects/plugins/wpcomsh/package.json b/projects/plugins/wpcomsh/package.json index ec2c2200465d4..b004d265af32a 100644 --- a/projects/plugins/wpcomsh/package.json +++ b/projects/plugins/wpcomsh/package.json @@ -3,7 +3,7 @@ "name": "@automattic/jetpack-wpcomsh", "description": "A helper for connecting WordPress.com sites to external host infrastructure.", "homepage": "https://jetpack.com", - "version": "3.22.6-alpha", + "version": "3.23.0-alpha", "bugs": { "url": "https://github.com/Automattic/jetpack/labels/[Plugin] Wpcomsh" }, diff --git a/projects/plugins/wpcomsh/wpcomsh.php b/projects/plugins/wpcomsh/wpcomsh.php index 51c8a8e7c64c2..4980f87d1914a 100644 --- a/projects/plugins/wpcomsh/wpcomsh.php +++ b/projects/plugins/wpcomsh/wpcomsh.php @@ -2,7 +2,7 @@ /** * Plugin Name: WordPress.com Site Helper * Description: A helper for connecting WordPress.com sites to external host infrastructure. - * Version: 3.22.6-alpha + * Version: 3.23.0-alpha * Author: Automattic * Author URI: http://automattic.com/ * @@ -10,7 +10,7 @@ */ // Increase version number if you change something in wpcomsh. -define( 'WPCOMSH_VERSION', '3.22.6-alpha' ); +define( 'WPCOMSH_VERSION', '3.23.0-alpha' ); // If true, Typekit fonts will be available in addition to Google fonts add_filter( 'jetpack_fonts_enable_typekit', '__return_true' ); From f67fbd2db6d29d2d0c3af46c47f3dbe9ae7fd35e Mon Sep 17 00:00:00 2001 From: Foteini Giannaropoulou Date: Fri, 14 Jun 2024 11:50:16 +0300 Subject: [PATCH 11/15] Fixup project versions --- projects/plugins/mu-wpcom-plugin/composer.json | 2 +- projects/plugins/mu-wpcom-plugin/mu-wpcom-plugin.php | 2 +- projects/plugins/mu-wpcom-plugin/package.json | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/projects/plugins/mu-wpcom-plugin/composer.json b/projects/plugins/mu-wpcom-plugin/composer.json index 7af84090b73c6..d399fcf014b2f 100644 --- a/projects/plugins/mu-wpcom-plugin/composer.json +++ b/projects/plugins/mu-wpcom-plugin/composer.json @@ -46,6 +46,6 @@ ] }, "config": { - "autoloader-suffix": "d9d132a783958a00a2c7cccff60ca42d_jetpack_mu_wpcom_pluginⓥ2_1_32" + "autoloader-suffix": "d9d132a783958a00a2c7cccff60ca42d_jetpack_mu_wpcom_pluginⓥ2_1_33_alpha" } } diff --git a/projects/plugins/mu-wpcom-plugin/mu-wpcom-plugin.php b/projects/plugins/mu-wpcom-plugin/mu-wpcom-plugin.php index bea97253fd0ed..47078e2c36aff 100644 --- a/projects/plugins/mu-wpcom-plugin/mu-wpcom-plugin.php +++ b/projects/plugins/mu-wpcom-plugin/mu-wpcom-plugin.php @@ -3,7 +3,7 @@ * * Plugin Name: WordPress.com Features * Description: Test plugin for the jetpack-mu-wpcom package - * Version: 2.1.32 + * Version: 2.1.33-alpha * Author: Automattic * License: GPLv2 or later * Text Domain: jetpack-mu-wpcom-plugin diff --git a/projects/plugins/mu-wpcom-plugin/package.json b/projects/plugins/mu-wpcom-plugin/package.json index 93793386eda9f..736d52fec211c 100644 --- a/projects/plugins/mu-wpcom-plugin/package.json +++ b/projects/plugins/mu-wpcom-plugin/package.json @@ -1,7 +1,7 @@ { "private": true, "name": "@automattic/jetpack-mu-wpcom-plugin", - "version": "2.1.32", + "version": "2.1.33-alpha", "description": "Test plugin for the jetpack-mu-wpcom package", "homepage": "https://jetpack.com", "bugs": { From ecfda38a9dff4a0836fd0d8dc2ce9de9882d6971 Mon Sep 17 00:00:00 2001 From: Foteini Giannaropoulou Date: Tue, 18 Jun 2024 11:52:41 +0300 Subject: [PATCH 12/15] Admin_Color_Schemes: Update core color overrides hooks --- .../class-admin-color-schemes.php | 28 ++++++++++++---- .../php/test-class-admin-color-schemes.php | 33 ++++++++++++------- 2 files changed, 43 insertions(+), 18 deletions(-) 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 3560a2fe6a657..08720f0817bb7 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 @@ -14,6 +14,13 @@ */ class Admin_Color_Schemes { + /** + * A list of core color schemes to override. + * + * @var array + */ + const CORE_COLOR_SCHEMES = array( 'blue', 'coffee', 'ectoplasm', 'fresh', 'light', 'midnight', 'modern', 'ocean', 'sunrise' ); + /** * Admin_Color_Schemes constructor. */ @@ -25,11 +32,10 @@ public function __construct() { add_action( 'rest_api_init', array( $this, 'register_admin_color_meta' ) ); } - if ( function_exists( 'wpcom_is_nav_redesign_enabled' ) && wpcom_is_nav_redesign_enabled() ) { - add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_core_color_schemes_overrides' ) ); + if ( function_exists( 'wpcom_is_nav_redesign_enabled' ) && wpcom_is_nav_redesign_enabled() ) { // Classic sites. add_filter( 'css_do_concat', array( $this, 'disable_css_concat_for_color_schemes' ), 10, 2 ); - } elseif ( false === ( new Host() )->is_wpcom_platform() ) { - // @todo Self-hosted sites. Remove this line when we disable the module for self-hosted. + add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_color_scheme_for_sidebar_notice' ) ); + } else { // Default and self-hosted sites. add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_core_color_schemes_overrides' ) ); } } @@ -194,15 +200,23 @@ public function register_admin_color_schemes() { * Enqueues current color-scheme overrides for core color schemes */ public function enqueue_core_color_schemes_overrides() { - $core_color_schemes = array( 'blue', 'coffee', 'ectoplasm', 'fresh', 'light', 'midnight', 'modern', 'ocean', 'sunrise' ); - $color_scheme = get_user_option( 'admin_color' ); - if ( in_array( $color_scheme, $core_color_schemes, true ) ) { + $color_scheme = get_user_option( 'admin_color' ); + if ( in_array( $color_scheme, static::CORE_COLOR_SCHEMES, true ) ) { wp_enqueue_style( 'jetpack-core-color-schemes-overrides', $this->get_admin_color_scheme_url( $color_scheme ), array(), Main::PACKAGE_VERSION ); + } + } + + /** + * Enqueues current color-scheme sidebar notice overrides for core color schemes + */ + public function enqueue_color_scheme_for_sidebar_notice() { + $color_scheme = get_user_option( 'admin_color' ); + if ( in_array( $color_scheme, static::CORE_COLOR_SCHEMES, true ) ) { wp_enqueue_style( 'jetpack-core-color-schemes-overrides-sidebar-notice', $this->get_admin_color_scheme_url( $color_scheme, 'sidebar-notice.css' ), diff --git a/projects/packages/masterbar/tests/php/test-class-admin-color-schemes.php b/projects/packages/masterbar/tests/php/test-class-admin-color-schemes.php index 3bf46d852babb..3f3272ef14b07 100644 --- a/projects/packages/masterbar/tests/php/test-class-admin-color-schemes.php +++ b/projects/packages/masterbar/tests/php/test-class-admin-color-schemes.php @@ -6,9 +6,8 @@ */ namespace Automattic\Jetpack\Masterbar; -use PHPUnit\Framework\TestCase; -use WorDBless\Options as WorDBless_Options; -use WorDBless\Users as WorDBless_Users; +use Brain\Monkey\Functions; +use WorDBless\BaseTestCase; use WP_Http; use WP_REST_Request; use WP_REST_Server; @@ -20,7 +19,7 @@ * * @covers Automattic\Jetpack\Masterbar\Admin_Color_Schemes */ -class Test_Admin_Color_Schemes extends TestCase { +class Test_Admin_Color_Schemes extends BaseTestCase { /** * REST Server object. @@ -38,8 +37,6 @@ class Test_Admin_Color_Schemes extends TestCase { /** * Set up each test. - * - * @before */ public function set_up() { global $wp_rest_server; @@ -55,6 +52,11 @@ public function set_up() { ) ); + if ( 'test_enqueue_core_color_schemes_overrides_for_classic_sites' === $this->getName() ) { + Functions\expect( 'wpcom_is_nav_redesign_enabled' ) + ->andReturn( true ); + } + new Admin_Color_Schemes(); do_action( 'rest_api_init' ); @@ -62,12 +64,10 @@ public function set_up() { /** * Returning the environment into its initial state. - * - * @after */ public function tear_down() { - WorDBless_Options::init()->clear_options(); - WorDBless_Users::init()->clear_all_users(); + wp_dequeue_style( 'jetpack-core-color-schemes-overrides' ); + wp_dequeue_style( 'jetpack-core-color-schemes-overrides-sidebar-notice' ); } /** @@ -153,7 +153,7 @@ public function test_update_color_scheme_will_fail_when_editor_updates_another_u $this->assertSame( 'rest_cannot_edit', $data['code'] ); } - public function test_enqueue_core_color_schemes_overrides() { + public function test_enqueue_core_color_schemes_overrides_for_default_and_self_hosted_sites() { wp_set_current_user( static::$user_id ); update_user_option( static::$user_id, 'admin_color', 'coffee' ); set_current_screen( 'edit-post' ); @@ -161,6 +161,17 @@ public function test_enqueue_core_color_schemes_overrides() { $this->assertFalse( wp_style_is( 'jetpack-core-color-schemes-overrides-sidebar-notice' ) ); do_action( 'admin_enqueue_scripts' ); $this->assertTrue( wp_style_is( 'jetpack-core-color-schemes-overrides' ) ); + $this->assertFalse( wp_style_is( 'jetpack-core-color-schemes-overrides-sidebar-notice' ) ); + } + + public function test_enqueue_core_color_schemes_overrides_for_classic_sites() { + wp_set_current_user( static::$user_id ); + update_user_option( static::$user_id, 'admin_color', 'coffee' ); + set_current_screen( 'edit-post' ); + $this->assertFalse( wp_style_is( 'jetpack-core-color-schemes-overrides' ) ); + $this->assertFalse( wp_style_is( 'jetpack-core-color-schemes-overrides-sidebar-notice' ) ); + do_action( 'admin_enqueue_scripts' ); + $this->assertFalse( wp_style_is( 'jetpack-core-color-schemes-overrides' ) ); $this->assertTrue( wp_style_is( 'jetpack-core-color-schemes-overrides-sidebar-notice' ) ); } } From a89ab8b3846d01f0f169c704defe09e0681507c9 Mon Sep 17 00:00:00 2001 From: Foteini Giannaropoulou Date: Tue, 18 Jun 2024 12:00:31 +0300 Subject: [PATCH 13/15] Fixup project versions --- projects/plugins/mu-wpcom-plugin/composer.json | 2 +- projects/plugins/mu-wpcom-plugin/mu-wpcom-plugin.php | 2 +- projects/plugins/mu-wpcom-plugin/package.json | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/projects/plugins/mu-wpcom-plugin/composer.json b/projects/plugins/mu-wpcom-plugin/composer.json index d399fcf014b2f..3f7533008db13 100644 --- a/projects/plugins/mu-wpcom-plugin/composer.json +++ b/projects/plugins/mu-wpcom-plugin/composer.json @@ -46,6 +46,6 @@ ] }, "config": { - "autoloader-suffix": "d9d132a783958a00a2c7cccff60ca42d_jetpack_mu_wpcom_pluginⓥ2_1_33_alpha" + "autoloader-suffix": "d9d132a783958a00a2c7cccff60ca42d_jetpack_mu_wpcom_pluginⓥ2_2_0_alpha" } } diff --git a/projects/plugins/mu-wpcom-plugin/mu-wpcom-plugin.php b/projects/plugins/mu-wpcom-plugin/mu-wpcom-plugin.php index 47078e2c36aff..a846a0be661c4 100644 --- a/projects/plugins/mu-wpcom-plugin/mu-wpcom-plugin.php +++ b/projects/plugins/mu-wpcom-plugin/mu-wpcom-plugin.php @@ -3,7 +3,7 @@ * * Plugin Name: WordPress.com Features * Description: Test plugin for the jetpack-mu-wpcom package - * Version: 2.1.33-alpha + * Version: 2.2.0-alpha * Author: Automattic * License: GPLv2 or later * Text Domain: jetpack-mu-wpcom-plugin diff --git a/projects/plugins/mu-wpcom-plugin/package.json b/projects/plugins/mu-wpcom-plugin/package.json index 736d52fec211c..74e9771c9d088 100644 --- a/projects/plugins/mu-wpcom-plugin/package.json +++ b/projects/plugins/mu-wpcom-plugin/package.json @@ -1,7 +1,7 @@ { "private": true, "name": "@automattic/jetpack-mu-wpcom-plugin", - "version": "2.1.33-alpha", + "version": "2.2.0-alpha", "description": "Test plugin for the jetpack-mu-wpcom package", "homepage": "https://jetpack.com", "bugs": { From 5b5722e96cbe1782888fd9772c2e495a1651362b Mon Sep 17 00:00:00 2001 From: Foteini Giannaropoulou Date: Tue, 18 Jun 2024 17:43:55 +0300 Subject: [PATCH 14/15] Fixup project versions --- projects/plugins/mu-wpcom-plugin/composer.json | 2 +- projects/plugins/mu-wpcom-plugin/mu-wpcom-plugin.php | 2 +- projects/plugins/mu-wpcom-plugin/package.json | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/projects/plugins/mu-wpcom-plugin/composer.json b/projects/plugins/mu-wpcom-plugin/composer.json index 42a9899976446..59b07779f5172 100644 --- a/projects/plugins/mu-wpcom-plugin/composer.json +++ b/projects/plugins/mu-wpcom-plugin/composer.json @@ -46,6 +46,6 @@ ] }, "config": { - "autoloader-suffix": "d9d132a783958a00a2c7cccff60ca42d_jetpack_mu_wpcom_pluginⓥ2_2_0" + "autoloader-suffix": "d9d132a783958a00a2c7cccff60ca42d_jetpack_mu_wpcom_pluginⓥ2_2_1_alpha" } } diff --git a/projects/plugins/mu-wpcom-plugin/mu-wpcom-plugin.php b/projects/plugins/mu-wpcom-plugin/mu-wpcom-plugin.php index b10c8b4666eaa..82b08c1c10cc4 100644 --- a/projects/plugins/mu-wpcom-plugin/mu-wpcom-plugin.php +++ b/projects/plugins/mu-wpcom-plugin/mu-wpcom-plugin.php @@ -3,7 +3,7 @@ * * Plugin Name: WordPress.com Features * Description: Test plugin for the jetpack-mu-wpcom package - * Version: 2.2.0 + * Version: 2.2.1-alpha * Author: Automattic * License: GPLv2 or later * Text Domain: jetpack-mu-wpcom-plugin diff --git a/projects/plugins/mu-wpcom-plugin/package.json b/projects/plugins/mu-wpcom-plugin/package.json index bbdeca482b55d..d8318ef3f6732 100644 --- a/projects/plugins/mu-wpcom-plugin/package.json +++ b/projects/plugins/mu-wpcom-plugin/package.json @@ -1,7 +1,7 @@ { "private": true, "name": "@automattic/jetpack-mu-wpcom-plugin", - "version": "2.2.0", + "version": "2.2.1-alpha", "description": "Test plugin for the jetpack-mu-wpcom package", "homepage": "https://jetpack.com", "bugs": { From abd2175df8ce72b8c560802da0200f66ef60cd06 Mon Sep 17 00:00:00 2001 From: Foteini Giannaropoulou Date: Wed, 19 Jun 2024 09:05:12 +0300 Subject: [PATCH 15/15] Fixup project versions --- .../changelog/add-masterbar-package-to-jetpack-mu-wpcom#2 | 5 +++++ projects/plugins/mu-wpcom-plugin/composer.lock | 2 +- .../changelog/add-masterbar-package-to-jetpack-mu-wpcom#2 | 5 +++++ projects/plugins/wpcomsh/composer.lock | 2 +- 4 files changed, 12 insertions(+), 2 deletions(-) create mode 100644 projects/plugins/mu-wpcom-plugin/changelog/add-masterbar-package-to-jetpack-mu-wpcom#2 create mode 100644 projects/plugins/wpcomsh/changelog/add-masterbar-package-to-jetpack-mu-wpcom#2 diff --git a/projects/plugins/mu-wpcom-plugin/changelog/add-masterbar-package-to-jetpack-mu-wpcom#2 b/projects/plugins/mu-wpcom-plugin/changelog/add-masterbar-package-to-jetpack-mu-wpcom#2 new file mode 100644 index 0000000000000..9aa70e3ec1f75 --- /dev/null +++ b/projects/plugins/mu-wpcom-plugin/changelog/add-masterbar-package-to-jetpack-mu-wpcom#2 @@ -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 f35b159e732df..ac4a7fdaaaf44 100644 --- a/projects/plugins/mu-wpcom-plugin/composer.lock +++ b/projects/plugins/mu-wpcom-plugin/composer.lock @@ -937,7 +937,7 @@ "dist": { "type": "path", "url": "../../packages/jetpack-mu-wpcom", - "reference": "7080bba6447f9bd0815793ded78e5e5fb681be0e" + "reference": "7ff93b7e86792a3647a0defcdffa63cf5c8fa97f" }, "require": { "automattic/jetpack-assets": "@dev", diff --git a/projects/plugins/wpcomsh/changelog/add-masterbar-package-to-jetpack-mu-wpcom#2 b/projects/plugins/wpcomsh/changelog/add-masterbar-package-to-jetpack-mu-wpcom#2 new file mode 100644 index 0000000000000..9aa70e3ec1f75 --- /dev/null +++ b/projects/plugins/wpcomsh/changelog/add-masterbar-package-to-jetpack-mu-wpcom#2 @@ -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 55b71aa3b9d31..fb8fc60f58660 100644 --- a/projects/plugins/wpcomsh/composer.lock +++ b/projects/plugins/wpcomsh/composer.lock @@ -1071,7 +1071,7 @@ "dist": { "type": "path", "url": "../../packages/jetpack-mu-wpcom", - "reference": "7080bba6447f9bd0815793ded78e5e5fb681be0e" + "reference": "7ff93b7e86792a3647a0defcdffa63cf5c8fa97f" }, "require": { "automattic/jetpack-assets": "@dev",