Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/trunk' into add/set-default-cate…
Browse files Browse the repository at this point in the history
…gory-quick-action
  • Loading branch information
mmtr committed Dec 19, 2024
2 parents 0b33e38 + ff26ecb commit 83c66fd
Show file tree
Hide file tree
Showing 84 changed files with 2,532 additions and 684 deletions.
11 changes: 11 additions & 0 deletions .github/files/lint-project-structure.sh
Original file line number Diff line number Diff line change
Expand Up @@ -635,4 +635,15 @@ while IFS= read -r FILE; do
done < <( git grep -h --line-number --column -o "$RE" "$FILE" )
done < <( git -c core.quotepath=off grep -l "$RE" )

# - Check for `random(` in scss files.
debug "Checking for SCSS random."
while IFS= read -r FILE; do
EXIT=1
while IFS=: read -r LINE COL X; do
X=${X%(}
echo "::error file=$FILE,line=$LINE,col=$COL::Do not use SCSS \`$X()\`. It means that every build will have different CSS, dirtying the diffs (and making for redudant Simple deploys if this gets into a relevant plugin)."
done < <( git grep -h --line-number --column -o '\(random\|unique-id\)\s*(' "$FILE" )
done < <( git -c core.quotepath=off grep -l '\(random\|unique-id\)\s*(' '*.sass' '*.scss' )


exit $EXIT
39 changes: 0 additions & 39 deletions .github/workflows/codeql-analysis.yml

This file was deleted.

2 changes: 1 addition & 1 deletion .phan/stubs/phpunit-stubs.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
/**
* Stubs automatically generated from PHPUnit 9.6.21
* Stubs automatically generated from PHPUnit 9.6.22
* using the definition file `tools/stubs/phpunit-stub-defs.php` in the Jetpack monorepo.
*
* Do not edit this directly! Run tools/stubs/update-stubs.sh to regenerate it.
Expand Down
3 changes: 2 additions & 1 deletion .phan/stubs/woocommerce-internal-stubs.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
/**
* Stubs automatically generated from WooCommerce 9.4.3
* Stubs automatically generated from WooCommerce 9.5.1
* using the definition file `tools/stubs/woocommerce-internal-stub-defs.php` in the Jetpack monorepo.
*
* Do not edit this directly! Run tools/stubs/update-stubs.sh to regenerate it.
Expand Down Expand Up @@ -50,6 +50,7 @@ class CustomOrdersTableController
*/
class OrdersTableDataStore extends \Abstract_WC_Order_Data_Store_CPT implements \WC_Object_Data_Store_Interface, \WC_Order_Data_Store_Interface
{
use \Automattic\WooCommerce\Internal\CostOfGoodsSold\CogsAwareTrait;
/**
* Get the custom orders table name.
*
Expand Down
2 changes: 1 addition & 1 deletion .phan/stubs/woocommerce-payments-stubs.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
/**
* Stubs automatically generated from WooPayments 8.6.0
* Stubs automatically generated from WooPayments 8.6.1
* using the definition file `tools/stubs/woocommerce-payments-stub-defs.php` in the Jetpack monorepo.
*
* Do not edit this directly! Run tools/stubs/update-stubs.sh to regenerate it.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Significance: patch
Type: changed
Comment: Notice component: Minor css adjustment.


Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,12 @@
display: flex;
align-items: center;
margin-top: 20px;
row-gap: 20px;
flex-wrap: wrap;

@media screen and ( max-width: 600px ) {
justify-content: center;
}

a {
&, &:hover, &:active, &:focus {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: minor
Type: added

Added the comments page to the list of untangled pages under the experiment
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: added

CSS Tidy: add css rule mask to allowlist
4 changes: 4 additions & 0 deletions projects/packages/jetpack-mu-wpcom/changelog/fix-wp-admin-rdv
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: fixed

Exclude the wpcom_admin_interface from the admin_menu action
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: fixed

Gutenberg 19.8.0 hotfix: don't show the template-locked rendering mode for pages
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: fixed

Holiday snow: Replace SCSS `random()` with pregenerated arrays of random numbers to make builds reproducable.
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ public static function load_features() {
require_once __DIR__ . '/features/wpcom-admin-dashboard/wpcom-admin-dashboard.php';
require_once __DIR__ . '/features/wpcom-block-editor/class-jetpack-wpcom-block-editor.php';
require_once __DIR__ . '/features/wpcom-block-editor/functions.editor-type.php';
require_once __DIR__ . '/features/wpcom-hotfixes/wpcom-hotfixes.php';
require_once __DIR__ . '/features/wpcom-logout/wpcom-logout.php';
require_once __DIR__ . '/features/wpcom-themes/wpcom-theme-fixes.php';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -549,6 +549,7 @@
$GLOBALS['csstidy']['all_properties']['marquee-play-count'] = 'CSS3.0';
$GLOBALS['csstidy']['all_properties']['marquee-speed'] = 'CSS3.0';
$GLOBALS['csstidy']['all_properties']['marquee-style'] = 'CSS3.0';
$GLOBALS['csstidy']['all_properties']['mask'] = 'CSS3.0';
$GLOBALS['csstidy']['all_properties']['mask-clip'] = 'CSS3.0';
$GLOBALS['csstidy']['all_properties']['mask-composite'] = 'CSS3.0';
$GLOBALS['csstidy']['all_properties']['mask-image'] = 'CSS3.0';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,22 @@ $snow_density: 10;
$snow_speed: 9s;
$snow_selector: '#jetpack-holiday-snow';

// Random numbers, to replace the `random` function so we can have reproducable builds.
// Needs $snow_density entries. Intergers 3-6.
$snow_sizes: 6, 6, 3, 5, 3, 4, 6, 5, 4, 6;
// Needs $snow_density entries. Floats 0.6-1.0.
$snow_alphas: 0.8, 1, 0.9, 1, 0.6, 1, 1, 1, 0.8, 1;
// Needs $snow_density * 2 entries. Floats 0-1.
$snow_positions: 0.17857, 0.30782, 0.65476, 0.04422, 0.31145, 0.02525, 0.72542, 0.19153, 0.26094, 0.12121, 0.47466, 0.76351, 0.46259, 0.92007, 0.24915, 0.44915, 0.19088, 0.86993, 0.62925, 0.68707;

html {
$grad: (
);

@for $i from 0 to $snow_density {
$v: random(4) + 2;
$alpha: random(5) * .1 + .5;
$grad: $grad, radial-gradient($v+px $v+px at (random($grid_width - $v * 2) + $v)+px (random($grid_width - $v * 2) + $v)+px,
$v: nth($snow_sizes, $i + 1);
$alpha: nth($snow_alphas, $i + 1);
$grad: $grad, radial-gradient($v+px $v+px at (round(nth($snow_positions, $i * 2 + 1) * ($grid_width - $v * 2)) + $v)+px (round(nth($snow_positions, $i * 2 + 2) * ($grid_width - $v * 2)) + $v)+px,
rgba(255, 255, 255, $alpha) 50%,
rgba(0, 0, 0, 0));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ function wpcom_replace_edit_profile_menu_to_me( $wp_admin_bar ) {
* @return string Name of the admin bar class.
*/
function wpcom_custom_wpcom_admin_bar_class( $wp_admin_bar_class ) {
if ( ! wpcom_is_using_default_admin_menu() ) {
if ( get_option( 'wpcom_admin_interface' ) === 'wp-admin' ) {
return $wp_admin_bar_class;
}

Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ function ( $location ) {
'tools.php?page=advertising',
'edit.php?post_type=jetpack-portfolio',
'edit.php?post_type=jetpack-testimonial',
'edit-comments.php',
'edit-tags.php?taxonomy=category',
'edit-tags.php?taxonomy=post_tag',
);
Expand Down Expand Up @@ -193,6 +194,21 @@ function wpcom_admin_get_user_option_jetpack( $value ) {
add_filter( 'get_user_option_jetpack_admin_menu_preferred_views', 'wpcom_admin_get_user_option_jetpack' );
add_filter( 'pre_option_wpcom_admin_interface', 'wpcom_admin_interface_pre_get_option', 10 );

add_action(
'admin_menu',
function () {
remove_filter( 'pre_option_wpcom_admin_interface', 'wpcom_admin_interface_pre_get_option' );
},
PHP_INT_MIN
);

add_action(
'admin_menu',
function () {
add_filter( 'pre_option_wpcom_admin_interface', 'wpcom_admin_interface_pre_get_option', 10 );
},
PHP_INT_MAX
);
/**
* Hides the "View" switcher on WP Admin screens enforced by the "Remove duplicate views" experiment.
*/
Expand Down Expand Up @@ -477,10 +493,12 @@ function wpcom_show_removed_calypso_screen_notice() {
wp_set_script_translations( $handle, 'jetpack-mu-wpcom', Jetpack_Mu_Wpcom::PKG_DIR . 'languages' );

global $title;
$config = wp_json_encode(
$clean_title = preg_replace( '/\(\d+\)/', '', $title );
$clean_title = trim( $clean_title );
$config = wp_json_encode(
array(
'imageUrl' => plugins_url( 'screens/' . sanitize_title( $current_screen ) . '.webp', __FILE__ ),
'title' => $title,
'title' => $clean_title,
'screen' => $current_screen,
'ajaxUrl' => admin_url( 'admin-ajax.php' ),
'dismissNonce' => wp_create_nonce( 'wpcom_dismiss_removed_calypso_screen_notice' ),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,24 +33,11 @@ function current_user_has_wpcom_account() {
return $has_account;
}

/**
* Check if the user has the default (Calypso) Admin menu.
*
* @return bool
*/
function wpcom_is_using_default_admin_menu() {
remove_filter( 'pre_option_wpcom_admin_interface', 'wpcom_admin_interface_pre_get_option' );
$option = get_option( 'wpcom_admin_interface' ) !== 'wp-admin';
add_filter( 'pre_option_wpcom_admin_interface', 'wpcom_admin_interface_pre_get_option', 10 );

return $option;
}

/**
* Adds a Hosting menu.
*/
function wpcom_add_hosting_menu() {
if ( wpcom_is_using_default_admin_menu() ) {
if ( get_option( 'wpcom_admin_interface' ) !== 'wp-admin' ) {
return;
}

Expand Down Expand Up @@ -162,7 +149,7 @@ function wpcom_add_hosting_menu() {
function wpcom_add_jetpack_submenu() {
$is_simple_site = defined( 'IS_WPCOM' ) && IS_WPCOM;
$is_atomic_site = ! $is_simple_site;
$uses_wp_admin_interface = ! wpcom_is_using_default_admin_menu();
$uses_wp_admin_interface = get_option( 'wpcom_admin_interface' ) === 'wp-admin';

if ( ! $uses_wp_admin_interface ) {
return;
Expand Down Expand Up @@ -392,7 +379,7 @@ function wpcom_add_plugins_menu() {
global $menu;
$is_simple_site = defined( 'IS_WPCOM' ) && IS_WPCOM;
$is_atomic_site = ! $is_simple_site;
$uses_wp_admin_interface = ! wpcom_is_using_default_admin_menu();
$uses_wp_admin_interface = get_option( 'wpcom_admin_interface' ) === 'wp-admin';

if ( $is_simple_site ) {
$has_plugins_menu = false;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php
/**
* Various hotfixes to WordPress.com
*
* @package automattic/jetpack-mu-wpcom
*/

/**
* Hotfix for a Gutenberg 19.8.0 bug preventing lower-capability users from editing pages.
* See: p1734525664059729-slack-C02FMH4G8
* See: https://github.com/WordPress/gutenberg/issues/68053#issuecomment-2550730705
*/
add_filter(
'register_post_type_args',
function ( $args ) {
unset( $args['default_rendering_mode'] );
return $args;
},
20
);
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
use Automattic\Jetpack\Connection\Manager as Connection_Manager;
use Automattic\Jetpack\Jetpack_Mu_Wpcom;

if ( wpcom_is_using_default_admin_menu() ) {
if ( get_option( 'wpcom_admin_interface' ) !== 'wp-admin' ) {
return;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ function wpcom_themes_show_banner() {
* Registers an "Appearance > Theme Showcase" menu.
*/
function wpcom_themes_add_theme_showcase_menu() {
if ( wpcom_is_using_default_admin_menu() ) {
if ( get_option( 'wpcom_admin_interface' ) !== 'wp-admin' ) {
return;
}

Expand Down
4 changes: 4 additions & 0 deletions projects/packages/masterbar/changelog/fix-wp-admin-rdv
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: fixed

Exclude the wpcom_admin_interface from the admin_menu action
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ public function add_tools_menu() {

// @phan-suppress-next-line PhanTypeMismatchArgumentProbablyReal -- Core should ideally document null for no-callback arg. https://core.trac.wordpress.org/ticket/52539.
add_submenu_page( 'tools.php', esc_attr__( 'Marketing', 'jetpack-masterbar' ), __( 'Marketing', 'jetpack-masterbar' ), 'publish_posts', 'https://wordpress.com/marketing/tools/' . $this->domain, null, 0 );
if ( $this->is_using_default_admin_menu() ) {
if ( ! $this->use_wp_admin_interface() ) {
// @phan-suppress-next-line PhanTypeMismatchArgumentProbablyReal -- Core should ideally document null for no-callback arg. https://core.trac.wordpress.org/ticket/52539.
add_submenu_page( 'tools.php', esc_attr__( 'Monetize', 'jetpack-masterbar' ), __( 'Monetize', 'jetpack-masterbar' ), 'manage_options', 'https://wordpress.com/earn/' . $this->domain, null, 1 );
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ function () {
);

// Add notices to the settings pages when there is a Calypso page available.
if ( get_option( 'wpcom_admin_interface' ) === 'wp-admin' ) {
if ( $this->use_wp_admin_interface() ) {
add_action( 'current_screen', array( $this, 'add_settings_page_notice' ) );
}
}
Expand Down Expand Up @@ -79,7 +79,7 @@ public function reregister_menu_items() {
$this->remove_gutenberg_menu();

// We don't need the `My Mailboxes` when the interface is set to wp-admin or the site is a staging site,
if ( $this->is_using_default_admin_menu() && ! get_option( 'wpcom_is_staging_site' ) ) {
if ( ! $this->use_wp_admin_interface() && ! get_option( 'wpcom_is_staging_site' ) ) {
$this->add_my_mailboxes_menu();
}

Expand Down Expand Up @@ -132,7 +132,7 @@ public function add_users_menu() {
$this->update_submenus( $slug, $submenus_to_update );
}

if ( $this->is_using_default_admin_menu() ) {
if ( ! $this->use_wp_admin_interface() ) {
// The 'Subscribers' menu exists in the Jetpack menu for Classic wp-admin interface, so only add it for non-wp-admin interfaces.
// // @phan-suppress-next-line PhanTypeMismatchArgumentProbablyReal -- Core should ideally document null for no-callback arg. https://core.trac.wordpress.org/ticket/52539.
add_submenu_page( 'users.php', esc_attr__( 'Subscribers', 'jetpack-masterbar' ), __( 'Subscribers', 'jetpack-masterbar' ), 'list_users', 'https://wordpress.com/subscribers/' . $this->domain, null );
Expand Down Expand Up @@ -322,7 +322,7 @@ public function get_upsell_nudge() {
*/
public function add_jetpack_menu() {
// This is supposed to be the same as class-admin-menu but with a different position specified for the Jetpack menu.
if ( ! $this->is_using_default_admin_menu() ) {
if ( $this->use_wp_admin_interface() ) {
parent::create_jetpack_menu( 2, false );
} else {
parent::add_jetpack_menu();
Expand Down Expand Up @@ -445,7 +445,7 @@ public function add_options_menu() {

// Hide Settings > Performance when the interface is set to wp-admin.
// This is due to these settings are mostly also available in Jetpack > Settings, in the Performance tab.
if ( ! $this->is_using_default_admin_menu() ) {
if ( $this->use_wp_admin_interface() ) {
$this->hide_submenu_page( 'options-general.php', 'https://wordpress.com/settings/performance/' . $this->domain );
}
}
Expand All @@ -457,7 +457,7 @@ public function add_tools_menu() {
parent::add_tools_menu();

// Link the Tools menu to Available Tools when the interface is set to wp-admin.
if ( ! $this->is_using_default_admin_menu() ) {
if ( $this->use_wp_admin_interface() ) {
// @phan-suppress-next-line PhanTypeMismatchArgumentProbablyReal -- Core should ideally document null for no-callback arg. https://core.trac.wordpress.org/ticket/52539.
add_submenu_page( 'tools.php', esc_attr__( 'Available Tools', 'jetpack-masterbar' ), __( 'Available Tools', 'jetpack-masterbar' ), 'edit_posts', 'tools.php', null, 0 );
}
Expand Down
Loading

0 comments on commit 83c66fd

Please sign in to comment.