Fix drafts not being saved

This commit is contained in:
Shadowfacts 2025-02-03 15:38:12 -05:00
parent fb39a93569
commit 25e4e35b1f
2 changed files with 10 additions and 2 deletions

View File

@ -70,7 +70,15 @@ public class Draft: NSManagedObject, Identifiable {
} }
extension Draft { extension Draft {
public var hasContent: Bool { var hasText: Bool {
!text.isEmpty && text != initialText !text.isEmpty && text != initialText
} }
var hasContentWarning: Bool {
contentWarningEnabled && contentWarning != initialContentWarning
}
public var hasContent: Bool {
hasText || hasContentWarning || attachments.count > 0 || (pollEnabled && poll!.hasContent)
}
} }

View File

@ -149,7 +149,7 @@ private struct PostButton: View {
private var draftValid: Bool { private var draftValid: Bool {
draft.editedStatusID != nil || draft.editedStatusID != nil ||
((draft.hasContent || draft.attachments.count > 0) ((draft.hasText || draft.attachments.count > 0)
&& hasCharactersRemaining && hasCharactersRemaining
&& attachmentsValid && attachmentsValid
&& pollValid) && pollValid)