Skip to content

Commit

Permalink
Merge pull request #16870 from wordpress-mobile/hotfix/post-publishin…
Browse files Browse the repository at this point in the history
…g-author

Only extract author info on a new Post / Page if the user can query for authors.
  • Loading branch information
twstokes authored Jul 16, 2021
2 parents 439b25a + d2b017f commit b8bd96f
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions WordPress/Classes/Services/PostService.m
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ - (Post *)createPostForBlog:(Blog *)blog {
post.postType = Post.typeDefaultIdentifier;

BlogAuthor *author = [blog getAuthorWithId:blog.userID];
post.authorID = author.userID ?: blog.account.userID;
post.author = author.displayName ?: blog.account.displayName;
post.authorID = author.userID;
post.author = author.displayName;

[blog.managedObjectContext obtainPermanentIDsForObjects:@[post] error:nil];
NSAssert(![post.objectID isTemporaryID], @"The new post for this blog must have a permanent ObjectID");
Expand All @@ -77,8 +77,8 @@ - (Page *)createPageForBlog:(Blog *)blog {
page.remoteStatus = AbstractPostRemoteStatusSync;

BlogAuthor *author = [blog getAuthorWithId:blog.userID];
page.authorID = author.userID ?: blog.account.userID;
page.author = author.displayName ?: blog.account.displayName;
page.authorID = author.userID;
page.author = author.displayName;

[blog.managedObjectContext obtainPermanentIDsForObjects:@[page] error:nil];
NSAssert(![page.objectID isTemporaryID], @"The new page for this blog must have a permanent ObjectID");
Expand Down

0 comments on commit b8bd96f

Please sign in to comment.