Skip to content

Commit 49b032d

Browse files
WPprodigymatticbot
authored andcommitted
JP Newsletter: Defer the call to is_connected() (#48005)
Committed via a GitHub action: https://github.com/Automattic/jetpack/actions/runs/24203511743 Upstream-Ref: Automattic/jetpack@65a7120
1 parent d65883d commit 49b032d

6 files changed

Lines changed: 118 additions & 115 deletions

File tree

composer.lock

Lines changed: 37 additions & 37 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

jetpack_vendor/automattic/jetpack-newsletter/CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ This is an alpha version! The changes listed here are not final.
1212
### Changed
1313
- Update package dependencies.
1414

15+
### Fixed
16+
- Defer is_connected() check from init to admin_menu callback to avoid caching a false result before External Storage providers are registered.
17+
1518
## [0.8.0] - 2026-04-06
1619
### Added
1720
- Newsletter settings: Disable settings and show a connection notice when the site has no connected owner. [#47927]

jetpack_vendor/automattic/jetpack-newsletter/src/class-settings.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -118,14 +118,9 @@ function ( $url ) {
118118
return;
119119
}
120120

121-
// On sites using Jetpack, only show the menu if the site is connected.
122-
if ( ! ( new Connection_Manager() )->is_connected() ) {
123-
return;
124-
}
125-
126121
// Add admin menu item.
127-
// The expose_to_users() check is deferred to add_wp_admin_menu() so that
128-
// filters registered after init() are available when admin_menu fires.
122+
// The expose_to_users() and is_connected() checks are deferred to add_wp_admin_menu()
123+
// so that filters registered after init() are available when admin_menu fires.
129124
// Use priority 999 to ensure menu items are queued BEFORE Admin_Menu::admin_menu_hook_callback
130125
// runs at priority 1000 to process all queued items.
131126
add_action( 'admin_menu', array( $this, 'add_wp_admin_menu' ), 999 );
@@ -145,6 +140,11 @@ public function add_wp_admin_menu() {
145140
return;
146141
}
147142

143+
// On sites using Jetpack, only show the menu if the site is connected.
144+
if ( ! ( new Connection_Manager() )->is_connected() ) {
145+
return;
146+
}
147+
148148
$host = new Host();
149149

150150
// When new settings are enabled, should_show_menu_item() controls visibility.

jetpack_vendor/i18n-map.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262
),
6363
'jetpack-newsletter' => array(
6464
'path' => 'jetpack_vendor/automattic/jetpack-newsletter',
65-
'ver' => '0.8.1-alpha1775666044',
65+
'ver' => '0.8.1-alpha1775754968',
6666
),
6767
'jetpack-password-checker' => array(
6868
'path' => 'jetpack_vendor/automattic/jetpack-password-checker',

0 commit comments

Comments
 (0)