Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 13 additions & 5 deletions Modules/Sources/WordPressKitObjC/AccountServiceRemoteREST.m
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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;
}];
}
Expand Down
2 changes: 2 additions & 0 deletions RELEASE-NOTES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is from a different PR, I think

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it is. I realized the missing release note when working on this PR. I thought I'd just add it here instead of creating a PR with one line change.


26.4
-----
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"is_following": false,
"is_private": false,
"jetpack": false,
"jetpack_connection": false,
"lang": "en",
"logo": {
"id": 0,
Expand Down Expand Up @@ -102,6 +103,7 @@
"is_following": false,
"is_private": false,
"jetpack": true,
"jetpack_connection": true,
"lang": "en",
"logo": {
"id": 0,
Expand Down
7 changes: 6 additions & 1 deletion WordPress/Classes/Services/BlogService.m
Original file line number Diff line number Diff line change
Expand Up @@ -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];
}

Expand Down