fix: mobile app connection owner bug (#37170)

This commit is contained in:
RJ 2023-03-16 16:20:36 +08:00 committed by GitHub
parent f50abc724f
commit 1c9b3a58fe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 3 deletions

View File

@ -89,8 +89,7 @@ export const useJetpackPluginState = () => {
); );
} else if ( } else if (
jetpackConnectionData && jetpackConnectionData &&
jetpackConnectionData?.currentUser?.username !== ! jetpackConnectionData?.currentUser?.isMaster
jetpackConnectionData?.connectionOwner
) { ) {
setPluginState( setPluginState(
JetpackPluginStates.NOT_OWNER_OF_CONNECTION JetpackPluginStates.NOT_OWNER_OF_CONNECTION

View File

@ -0,0 +1,4 @@
Significance: minor
Type: fix
fixed bug where jetpack connection owner field was assumed to be username when its actually display name

View File

@ -90,7 +90,7 @@ class GetMobileApp extends Task {
private static function is_current_user_connected() { private static function is_current_user_connected() {
if ( class_exists( '\Automattic\Jetpack\Connection\Manager' ) && method_exists( '\Automattic\Jetpack\Connection\Manager', 'is_user_connected' ) ) { if ( class_exists( '\Automattic\Jetpack\Connection\Manager' ) && method_exists( '\Automattic\Jetpack\Connection\Manager', 'is_user_connected' ) ) {
$connection = new Manager(); $connection = new Manager();
return $connection->is_user_connected(); return $connection->is_connection_owner();
} }
return false; return false;
} }