mirror of
https://github.com/writeas/writefreely-swiftui-multiplatform.git
synced 2024-11-15 01:11:02 +00:00
Check that we're working with model's selectedPost property
This commit is contained in:
parent
f948a16ad0
commit
f589d42794
@ -64,7 +64,7 @@ struct ActivePostToolbarView: View {
|
|||||||
}, label: {
|
}, label: {
|
||||||
Label("Publish…", systemImage: "paperplane")
|
Label("Publish…", systemImage: "paperplane")
|
||||||
})
|
})
|
||||||
.disabled(model.selectedPost!.body.isEmpty)
|
.disabled(model.selectedPost?.body.isEmpty ?? true)
|
||||||
.help("Publish the post to the web.\(model.account.isLoggedIn ? "" : " You must be logged in to do this.")") // swiftlint:disable:this line_length
|
.help("Publish the post to the web.\(model.account.isLoggedIn ? "" : " You must be logged in to do this.")") // swiftlint:disable:this line_length
|
||||||
} else {
|
} else {
|
||||||
HStack(spacing: 4) {
|
HStack(spacing: 4) {
|
||||||
@ -114,6 +114,9 @@ struct ActivePostToolbarView: View {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private func publishPost(_ post: WFAPost) {
|
private func publishPost(_ post: WFAPost) {
|
||||||
|
if post != model.selectedPost {
|
||||||
|
return
|
||||||
|
}
|
||||||
DispatchQueue.main.async {
|
DispatchQueue.main.async {
|
||||||
LocalStorageManager().saveContext()
|
LocalStorageManager().saveContext()
|
||||||
model.publish(post: post)
|
model.publish(post: post)
|
||||||
|
Loading…
Reference in New Issue
Block a user