diff --git a/Modules/Sources/WordPressKitObjC/AccountServiceRemoteREST.m b/Modules/Sources/WordPressKitObjC/AccountServiceRemoteREST.m index fe0d75aefc18..984df146bfc8 100644 --- a/Modules/Sources/WordPressKitObjC/AccountServiceRemoteREST.m +++ b/Modules/Sources/WordPressKitObjC/AccountServiceRemoteREST.m @@ -376,6 +376,19 @@ - (void)getBlogsWithParameters:(NSDictionary *)parameters { NSString *requestUrl = [self pathForEndpoint:@"me/sites" withVersion:WordPressComRESTAPIVersion_1_2]; + // site_activity=active filters out many sites that are not longer available. + // + // For example, if you have a self-hosted site that's connected to a WP.com account, and later the site domain expires + // and couldn't be accessed, we don't want to show this site in the app. These sites are filtered out by the + // `site_activity=active` parameter. + // + // For reference, this paramter is hard-coded in "My Sites" in calypso: + // https://github.com/Automattic/wp-calypso/blob/64806d21520e5489b30fbabf04e2f427a3ad392c/packages/api-core/src/me-sites/fetchers.ts#L30 + if (parameters[@"site_activity"] == nil) { + NSMutableDictionary *updated = [NSMutableDictionary dictionaryWithDictionary:parameters]; + updated[@"site_activity"] = @"active"; + parameters = updated; + } [self.wordPressComRESTAPI get:requestUrl parameters:parameters success:^(id responseObject, NSHTTPURLResponse *httpResponse) { @@ -417,11 +430,6 @@ - (NSArray *)remoteBlogsFromJSONArray:(NSArray *)jsonBlogs return false; } - // Exclude sites that are connected via Jetpack, but without an active Jetpack connection. - if (blog.jetpackConnection && !blog.jetpack) { - return false; - } - return true; }]; } diff --git a/RELEASE-NOTES.txt b/RELEASE-NOTES.txt index 439ae0936e76..0357354dbd1b 100644 --- a/RELEASE-NOTES.txt +++ b/RELEASE-NOTES.txt @@ -10,6 +10,8 @@ * [*] Add permalink preview in the slug editor and make other improvements [#24949] * [*] Add "Taxonomies" to Site Settings [#24955] * [*] Update "Categories" picker to indicate multiple selection [#24952] +* [*] Fix a bug where the app can't access some Jetpack connected sites [#24976] +* [*] Add support for editing custom taxonomy terms from "Post Settings" [#24964] 26.4 ----- diff --git a/Tests/KeystoneTests/Resources/Mocks/User/me-sites-with-jetpack.json b/Tests/KeystoneTests/Resources/Mocks/User/me-sites-with-jetpack.json index 01895678fad8..f3dfd99c55a6 100644 --- a/Tests/KeystoneTests/Resources/Mocks/User/me-sites-with-jetpack.json +++ b/Tests/KeystoneTests/Resources/Mocks/User/me-sites-with-jetpack.json @@ -17,6 +17,7 @@ "is_following": false, "is_private": false, "jetpack": false, + "jetpack_connection": false, "lang": "en", "logo": { "id": 0, @@ -102,6 +103,7 @@ "is_following": false, "is_private": false, "jetpack": true, + "jetpack_connection": true, "lang": "en", "logo": { "id": 0, diff --git a/WordPress/Classes/Services/BlogService.m b/WordPress/Classes/Services/BlogService.m index 1df554172984..55e2588e779d 100644 --- a/WordPress/Classes/Services/BlogService.m +++ b/WordPress/Classes/Services/BlogService.m @@ -493,7 +493,12 @@ - (void)updateBlogWithRemoteBlog:(RemoteBlog *)remoteBlog account:(WPAccount *)a { Blog *blog = [self findBlogWithDotComID:remoteBlog.blogID inAccount:account]; - if (!blog && remoteBlog.jetpack) { + // Previously the `remoteBlog.jetpack` property was used to check if the `blog` is connected to Jetpack. + // However, the `jetpack` property indicated whether the Jetpack plugin is installed, and we should check the + // `jetpack_connection` property instead. + // See this calypso code for reference: + // https://github.com/Automattic/wp-calypso/blob/61a1eb0968da82e62d992f8d081a4ab3075c7719/client/dashboard/utils/site-types.ts#L3 + if (!blog && remoteBlog.jetpackConnection) { blog = [self migrateRemoteJetpackBlog:remoteBlog forAccount:account inContext:context]; }