From a7f982e827a0ff45fc97a82e44819ad93bd1704a Mon Sep 17 00:00:00 2001 From: Thomas Ricouard Date: Sun, 17 Dec 2023 07:52:16 +0100 Subject: [PATCH] Fix posting order for threads --- .../Sources/Status/Editor/StatusEditorToolbarItems.swift | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Packages/Status/Sources/Status/Editor/StatusEditorToolbarItems.swift b/Packages/Status/Sources/Status/Editor/StatusEditorToolbarItems.swift index 020ca1be..0b4022c9 100644 --- a/Packages/Status/Sources/Status/Editor/StatusEditorToolbarItems.swift +++ b/Packages/Status/Sources/Status/Editor/StatusEditorToolbarItems.swift @@ -99,10 +99,13 @@ struct StatusEditorToolbarItems: ToolbarContent { } private func postAllStatus() async { - guard let openingPost = await postStatus(with: mainSEVM, isMainPost: true) else { return } + guard var latestPost = await postStatus(with: mainSEVM, isMainPost: true) else { return } for p in followUpSEVMs { - p.mode = .replyTo(status: openingPost) - await postStatus(with: p, isMainPost: false) + p.mode = .replyTo(status: latestPost) + guard let post = await postStatus(with: p, isMainPost: false) else { + break + } + latestPost = post } }