Skip to content

Commit

Permalink
Only extract author information if the user can query for authors.
Browse files Browse the repository at this point in the history
  • Loading branch information
twstokes committed Jul 15, 2021
1 parent b497c6d commit d2b017f
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 d2b017f

Please sign in to comment.