Skip to content
This repository was archived by the owner on Sep 15, 2025. It is now read-only.

Commit ed050d0

Browse files
authored
Do not show disconnected Jetpack sites (#835)
2 parents 7dc4ed3 + b6ada40 commit ed050d0

File tree

3 files changed

+17
-4
lines changed

3 files changed

+17
-4
lines changed

Package.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ let package = Package(
1111
targets: [
1212
.binaryTarget(
1313
name: "WordPressKit",
14-
url: "https://github.com/user-attachments/files/19339848/WordPressKit.zip",
15-
checksum: "5bf1ff361992dccf44dfe41b0a442ee4c3c13dc0a1ce9b647a8ed1b976b5c3fc"
14+
url: "https://github.com/user-attachments/files/19658656/WordPressKit.zip",
15+
checksum: "9172f9b9906e64efe1f3d79f074ad317f1d40c6ce1ec394259b0f99fea6fe8ee"
1616
),
1717
]
1818
)

Sources/WordPressKit/Models/RemoteBlog.swift

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,12 @@ import Foundation
3737
/// Features available for the current blog's plan.
3838
public var planActiveFeatures = [String]()
3939

40-
/// Indicates whether it's a jetpack site, or not.
40+
/// Indicates whether the site is a Jetpack site or not.
4141
public var jetpack: Bool = false
4242

43+
/// Indicates whether the site is connected to WP.com via `jetpack-connection`.
44+
public var jetpackConnection: Bool = false
45+
4346
/// Boolean indicating whether the current user has Admin privileges, or not.
4447
public var isAdmin: Bool = false
4548

@@ -70,6 +73,7 @@ import Foundation
7073
self.url = json.string(forKey: "URL") ?? ""
7174
self.xmlrpc = json.string(forKeyPath: "meta.links.xmlrpc")
7275
self.jetpack = json.number(forKey: "jetpack")?.boolValue ?? false
76+
self.jetpackConnection = json.number(forKey: "jetpack_connection")?.boolValue ?? false
7377
self.icon = json.string(forKeyPath: "icon.img")
7478
self.capabilities = json.object(forKey: "capabilities") as? [String: Bool] ?? [:]
7579
self.isAdmin = json.number(forKeyPath: "capabilities.manage_options")?.boolValue ?? false

Sources/WordPressKit/Services/AccountServiceRemoteREST.m

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,16 @@ - (NSArray *)remoteBlogsFromJSONArray:(NSArray *)jsonBlogs
391391
// Exclude deleted sites from query result, since the app does not handle deleted sites properly.
392392
// I tried to use query arguments `site_visibility=visible` and `site_activity=active`, but neither excludes
393393
// deleted sites.
394-
return !blog.isDeleted;
394+
if (blog.isDeleted) {
395+
return false;
396+
}
397+
398+
// Exclude sites that are connected via Jetpack, but without an active Jetpack connection.
399+
if (blog.jetpackConnection && !blog.jetpack) {
400+
return false;
401+
}
402+
403+
return true;
395404
}];
396405
}
397406

0 commit comments

Comments
 (0)