From c0148bb770fdf24b718e35eb878ce7724382a4c2 Mon Sep 17 00:00:00 2001 From: Shadowfacts Date: Sat, 27 May 2023 15:28:39 -0700 Subject: [PATCH] Fix Delete attachment context menu action not working Closes #394 --- .../ComposeUI/Controllers/AttachmentRowController.swift | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Packages/ComposeUI/Sources/ComposeUI/Controllers/AttachmentRowController.swift b/Packages/ComposeUI/Sources/ComposeUI/Controllers/AttachmentRowController.swift index 31a3569c..0762c2d3 100644 --- a/Packages/ComposeUI/Sources/ComposeUI/Controllers/AttachmentRowController.swift +++ b/Packages/ComposeUI/Sources/ComposeUI/Controllers/AttachmentRowController.swift @@ -49,7 +49,9 @@ class AttachmentRowController: ViewController { private func removeAttachment() { withAnimation { - parent.draft.attachments.remove(attachment) + var newAttachments = parent.draft.draftAttachments + newAttachments.removeAll(where: { $0.id == attachment.id }) + parent.draft.attachments = NSMutableOrderedSet(array: newAttachments) } }