diff --git a/Packages/ComposeUI/Sources/ComposeUI/CoreData/Draft.swift b/Packages/ComposeUI/Sources/ComposeUI/CoreData/Draft.swift index cbbd0fc0..2f37284a 100644 --- a/Packages/ComposeUI/Sources/ComposeUI/CoreData/Draft.swift +++ b/Packages/ComposeUI/Sources/ComposeUI/CoreData/Draft.swift @@ -25,6 +25,7 @@ public class Draft: NSManagedObject, Identifiable { @NSManaged public var contentWarningEnabled: Bool @NSManaged public var editedStatusID: String? @NSManaged public var id: UUID + @NSManaged public var initialContentWarning: String? @NSManaged public var initialText: String @NSManaged public var inReplyToID: String? @NSManaged public var language: String? // ISO 639 language code @@ -65,7 +66,7 @@ public class Draft: NSManagedObject, Identifiable { extension Draft { public var hasContent: Bool { (!text.isEmpty && text != initialText) || - (contentWarningEnabled && !contentWarning.isEmpty) || + (contentWarningEnabled && !contentWarning.isEmpty && contentWarning != initialContentWarning) || attachments.count > 0 || poll?.hasContent == true } diff --git a/Packages/ComposeUI/Sources/ComposeUI/CoreData/Drafts.xcdatamodeld/Drafts.xcdatamodel/contents b/Packages/ComposeUI/Sources/ComposeUI/CoreData/Drafts.xcdatamodeld/Drafts.xcdatamodel/contents index 75c66813..f7048141 100644 --- a/Packages/ComposeUI/Sources/ComposeUI/CoreData/Drafts.xcdatamodeld/Drafts.xcdatamodel/contents +++ b/Packages/ComposeUI/Sources/ComposeUI/CoreData/Drafts.xcdatamodeld/Drafts.xcdatamodel/contents @@ -1,11 +1,12 @@ - + + diff --git a/Packages/ComposeUI/Sources/ComposeUI/CoreData/DraftsPersistentContainer.swift b/Packages/ComposeUI/Sources/ComposeUI/CoreData/DraftsPersistentContainer.swift index 6a86798d..c87ad5bf 100644 --- a/Packages/ComposeUI/Sources/ComposeUI/CoreData/DraftsPersistentContainer.swift +++ b/Packages/ComposeUI/Sources/ComposeUI/CoreData/DraftsPersistentContainer.swift @@ -88,6 +88,7 @@ public class DraftsPersistentContainer: NSPersistentContainer { draft.text = text draft.initialText = text draft.contentWarning = contentWarning + draft.initialContentWarning = contentWarning draft.contentWarningEnabled = !contentWarning.isEmpty draft.inReplyToID = inReplyToID draft.visibility = visibility @@ -112,6 +113,7 @@ public class DraftsPersistentContainer: NSPersistentContainer { draft.initialText = source.text draft.contentWarning = source.spoilerText draft.contentWarningEnabled = !source.spoilerText.isEmpty + draft.initialContentWarning = source.spoilerText draft.inReplyToID = inReplyToID draft.visibility = visibility draft.localOnly = localOnly