Filter out local posts from postsToDelete array

This commit is contained in:
Angelo Stavrow 2020-09-21 11:51:32 -04:00
parent 4c9f5d3348
commit 148deaf911
No known key found for this signature in database
GPG Key ID: 1A49C7064E060EEE

View File

@ -245,7 +245,7 @@ private extension WriteFreelyModel {
func fetchUserPostsHandler(result: Result<[WFPost], Error>) {
do {
var postsToDelete = posts.userPosts
var postsToDelete = posts.userPosts.filter { $0.status != PostStatus.local.rawValue }
let fetchedPosts = try result.get()
for fetchedPost in fetchedPosts {
if let managedPost = posts.userPosts.first(where: { $0.postId == fetchedPost.postId }) {