Merge pull request #151 from writeas/improve-new-post-reliability

Improve new-post reliability
This commit is contained in:
Angelo Stavrow 2020-12-11 09:40:36 -05:00 committed by GitHub
commit 7a86da92a2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 4 deletions

View File

@ -87,7 +87,16 @@ struct PostListFilteredView: View {
tag: post,
selection: $model.selectedPost
) {
PostCellView(post: post)
if showAllPosts {
if let collection = collections.filter { $0.alias == post.collectionAlias }.first {
PostCellView(post: post, collectionName: collection.title)
} else {
let collectionName = model.account.server == "https://write.as" ? "Anonymous" : "Drafts"
PostCellView(post: post, collectionName: collectionName)
}
} else {
PostCellView(post: post)
}
}
.deleteDisabled(post.status != PostStatus.local.rawValue)
}

View File

@ -104,9 +104,9 @@ struct PostListView: View {
}
.onDisappear {
DispatchQueue.main.async {
model.selectedCollection = nil
model.showAllPosts = true
model.selectedPost = nil
self.model.selectedCollection = nil
self.model.showAllPosts = true
self.model.selectedPost = nil
}
}
.navigationTitle(