Skip to content

Commit

Permalink
wrap the removal of My Mailboxes in a call to wpcom_is_duplicate_view…
Browse files Browse the repository at this point in the history
…s_experiment_enabled so it's hidden behind the experiment
  • Loading branch information
scruffian committed Jan 9, 2025
1 parent 8c6a84a commit 613a079
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,14 @@ public function add_my_home_menu() {
$this->update_menu( 'index.php', 'https://wordpress.com/home/' . $this->domain, __( 'My Home', 'jetpack-masterbar' ), 'read', 'dashicons-admin-home' );
}

/**
* Adds My Mailboxes menu.
*/
public function add_my_mailboxes_menu() {
// @phan-suppress-next-line PhanTypeMismatchArgumentProbablyReal -- Core should ideally document null for no-callback arg. https://core.trac.wordpress.org/ticket/52539.
add_menu_page( __( 'My Mailboxes', 'jetpack-masterbar' ), __( 'My Mailboxes', 'jetpack-masterbar' ), 'manage_options', 'https://wordpress.com/mailboxes/' . $this->domain, null, 'dashicons-email', 4.64424 );
}

/**
* Adds Stats menu.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,13 @@ public function reregister_menu_items() {
$this->add_my_home_menu();
$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->use_wp_admin_interface() && ! get_option( 'wpcom_is_staging_site' ) ) {
if ( function_exists( 'wpcom_is_duplicate_views_experiment_enabled' ) && ! wpcom_is_duplicate_views_experiment_enabled() ) {
$this->add_my_mailboxes_menu();
}
}

// Not needed outside of wp-admin.
if ( ! $this->is_api_request ) {
$this->add_site_card_menu();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ public function reregister_menu_items() {
parent::reregister_menu_items();

$this->add_my_home_menu();
if ( function_exists( 'wpcom_is_duplicate_views_experiment_enabled' ) && ! wpcom_is_duplicate_views_experiment_enabled() ) {
$this->add_my_mailboxes_menu();
}
$this->remove_gutenberg_menu();

// Not needed outside of wp-admin.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,19 @@ public function test_add_upgrades_menu() {
}
}

/**
* Tests add_my_mailboxes_menu
*
* @covers Automattic\Jetpack\Masterbar\Atomic_Admin_Menu::add_my_mailboxes_menu
*/
public function test_add_my_mailboxes_menu() {
global $menu;

static::$admin_menu->add_my_mailboxes_menu();

$this->assertSame( 'https://wordpress.com/mailboxes/' . static::$domain, $menu['4.64424'][2] );
}

/**
* Tests add_options_menu
*
Expand Down

0 comments on commit 613a079

Please sign in to comment.