File tree 2 files changed +9
-2
lines changed 2 files changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -58,6 +58,8 @@ import Foundation
58
58
/// Blog's total disk quota space used.
59
59
public var quotaSpaceUsed : NSNumber ?
60
60
61
+ public var isDeleted : Bool
62
+
61
63
/// Parses details from a JSON dictionary, as returned by the WordPress.com REST API.
62
64
@objc ( initWithJSONDictionary: )
63
65
public init ( jsonDictionary json: NSDictionary ) {
@@ -79,6 +81,7 @@ import Foundation
79
81
self . planActiveFeatures = ( json. array ( forKeyPath: " plan.features.active " ) as? [ String ] ) ?? [ ]
80
82
self . quotaSpaceAllowed = json. number ( forKeyPath: " quota.space_allowed " )
81
83
self . quotaSpaceUsed = json. number ( forKeyPath: " quota.space_used " )
84
+ self . isDeleted = json. number ( forKey: " is_deleted " ) ? . boolValue == true
82
85
}
83
86
84
87
}
Original file line number Diff line number Diff line change @@ -385,10 +385,14 @@ - (RemoteUser *)remoteUserFromDictionary:(NSDictionary *)dictionary
385
385
- (NSArray *)remoteBlogsFromJSONArray : (NSArray *)jsonBlogs
386
386
{
387
387
NSArray *blogs = jsonBlogs;
388
- return [blogs wpkit_map: ^id (NSDictionary *jsonBlog) {
388
+ return [[ blogs wpkit_map: ^id (NSDictionary *jsonBlog) {
389
389
return [[RemoteBlog alloc ] initWithJSONDictionary: jsonBlog];
390
+ }] wpkit_filter: ^BOOL (RemoteBlog *blog) {
391
+ // Exclude deleted sites from query result, since the app does not handle deleted sites properly.
392
+ // I tried to use query arguments `site_visibility=visible` and `site_activity=active`, but neither excludes
393
+ // deleted sites.
394
+ return !blog.isDeleted ;
390
395
}];
391
- return blogs;
392
396
}
393
397
394
398
@end
You can’t perform that action at this time.
0 commit comments