Skip to content

Commit 9edac5f

Browse files
authored
Fix an issue with Publisize options appearing in the prepublishing sheet for sites that don't support it (#23949)
2 parents 4b741ea + 99b0ba2 commit 9edac5f

File tree

3 files changed

+32
-32
lines changed

3 files changed

+32
-32
lines changed

WordPress/Classes/Models/Blog/Blog+Capabilities.swift

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,21 @@ extension Blog {
66
/// Enumeration that contains all of the Blog's available capabilities.
77
///
88
public enum Capability: String {
9-
case DeleteOthersPosts = "delete_others_posts"
10-
case DeletePosts = "delete_posts"
11-
case EditOthersPages = "edit_others_pages"
12-
case EditOthersPosts = "edit_others_posts"
13-
case EditPages = "edit_pages"
14-
case EditPosts = "edit_posts"
15-
case EditThemeOptions = "edit_theme_options"
16-
case EditUsers = "edit_users"
17-
case ListUsers = "list_users"
18-
case ManageCategories = "manage_categories"
19-
case ManageOptions = "manage_options"
20-
case PromoteUsers = "promote_users"
21-
case PublishPosts = "publish_posts"
22-
case UploadFiles = "upload_files"
23-
case ViewStats = "view_stats"
9+
case DeleteOthersPosts = "delete_others_posts"
10+
case DeletePosts = "delete_posts"
11+
case EditOthersPages = "edit_others_pages"
12+
case EditOthersPosts = "edit_others_posts"
13+
case EditPages = "edit_pages"
14+
case EditPosts = "edit_posts"
15+
case EditThemeOptions = "edit_theme_options"
16+
case EditUsers = "edit_users"
17+
case ListUsers = "list_users"
18+
case ManageCategories = "manage_categories"
19+
case ManageOptions = "manage_options"
20+
case PromoteUsers = "promote_users"
21+
case PublishPosts = "publish_posts"
22+
case UploadFiles = "upload_files"
23+
case ViewStats = "view_stats"
2424
}
2525

2626
/// Returns true if a given capability is enabled. False otherwise

WordPress/Classes/Models/Blog/Blog.h

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -194,20 +194,20 @@ typedef NS_ENUM(NSInteger, SiteVisibility) {
194194
*
195195
* @warn For WordPress.com or Jetpack Managed sites this will be nil. Use usernameForSite instead
196196
*/
197-
@property (nonatomic, strong, readwrite, nullable) NSString *username;
198-
@property (nonatomic, strong, readwrite, nullable) NSString *password;
197+
@property (nonatomic, strong, readwrite, nullable) NSString *username;
198+
@property (nonatomic, strong, readwrite, nullable) NSString *password;
199199

200200

201201
// Readonly Properties
202-
@property (nonatomic, weak, readonly, nullable) NSArray *sortedPostFormatNames;
203-
@property (nonatomic, weak, readonly, nullable) NSArray *sortedPostFormats;
204-
@property (nonatomic, weak, readonly, nullable) NSArray *sortedConnections;
202+
@property (nonatomic, weak, readonly, nullable) NSArray *sortedPostFormatNames;
203+
@property (nonatomic, weak, readonly, nullable) NSArray *sortedPostFormats;
204+
@property (nonatomic, weak, readonly, nullable) NSArray *sortedConnections;
205205
@property (nonatomic, readonly, nullable) NSArray<Role *> *sortedRoles;
206-
@property (nonatomic, strong, readonly, nullable) WordPressOrgXMLRPCApi *xmlrpcApi;
207-
@property (nonatomic, strong, readonly, nullable) WordPressOrgRestApi *selfHostedSiteRestApi;
208-
@property (nonatomic, weak, readonly, nullable) NSString *version;
209-
@property (nonatomic, strong, readonly, nullable) NSString *authToken;
210-
@property (nonatomic, strong, readonly, nullable) NSSet *allowedFileTypes;
206+
@property (nonatomic, strong, readonly, nullable) WordPressOrgXMLRPCApi *xmlrpcApi;
207+
@property (nonatomic, strong, readonly, nullable) WordPressOrgRestApi *selfHostedSiteRestApi;
208+
@property (nonatomic, weak, readonly, nullable) NSString *version;
209+
@property (nonatomic, strong, readonly, nullable) NSString *authToken;
210+
@property (nonatomic, strong, readonly, nullable) NSSet *allowedFileTypes;
211211
@property (nonatomic, copy, readonly, nullable) NSString *usernameForSite;
212212
@property (nonatomic, assign, readonly) BOOL canBlaze;
213213

WordPress/Classes/ViewRelated/Post/Prepublishing/PrepublishingViewController+JetpackSocial.swift

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,12 @@ extension PrepublishingViewController {
88
/// Determines whether the account and the post's blog is eligible to see the Jetpack Social row.
99
func canDisplaySocialRow(isJetpack: Bool = AppConfiguration.isJetpack,
1010
isFeatureEnabled: Bool = RemoteFeatureFlag.jetpackSocialImprovements.enabled()) -> Bool {
11-
guard isJetpack && isFeatureEnabled && !isPostPrivate && hasPublicizeServices else {
11+
guard isJetpack &&
12+
isFeatureEnabled &&
13+
!isPostPrivate &&
14+
hasPublicizeServices &&
15+
post.blog.supportsPublicize()
16+
else {
1217
return false
1318
}
1419

@@ -17,12 +22,7 @@ extension PrepublishingViewController {
1722
return !isNoConnectionDismissed
1823
}
1924

20-
let blogSupportsPublicize = coreDataStack.performQuery { [postObjectID = post.objectID] context in
21-
let post = (try? context.existingObject(with: postObjectID)) as? Post
22-
return post?.blog.supportsPublicize() ?? false
23-
}
24-
25-
return blogSupportsPublicize
25+
return true
2626
}
2727

2828
func configureSocialCell(_ cell: UITableViewCell) {

0 commit comments

Comments
 (0)