From 9528c812121f53fdb2bc34fcdf2f30dd6255e7f1 Mon Sep 17 00:00:00 2001 From: Vitor Pamplona Date: Mon, 28 Sep 2026 10:47:50 -0400 Subject: [PATCH] fix(chats): replying while editing a message drops the edit's text reply() left edit mode but kept the edited message's prefilled text, so Send posted it again as a new reply. It now cancels the edit, text included, in Marmot and in Concord (which had the same bug). Checked on the tablet: Edit a message, Reply to another, the composer is empty. Co-Authored-By: Claude Opus 5.5 --- .../chats/marmotGroup/send/MarmotNewMessageViewModel.kt | 4 +++- .../publicChannels/concord/send/ConcordNewMessageViewModel.kt | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/marmotGroup/send/MarmotNewMessageViewModel.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/marmotGroup/send/MarmotNewMessageViewModel.kt index 36e1beb9ad..ac02ee25e1 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/marmotGroup/send/MarmotNewMessageViewModel.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/marmotGroup/send/MarmotNewMessageViewModel.kt @@ -93,7 +93,9 @@ open class MarmotNewMessageViewModel : ViewModel() { fun reply(note: Note) { replyTo.value = note - editingMessage.value = null + // Leaving edit mode drops the edited message's prefilled text too; kept, Send would + // post it again as a new reply. + if (editingMessage.value != null) cancelEdit() } /** Enter edit mode for my own [note], prefilled with the text it currently shows. */ diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/publicChannels/concord/send/ConcordNewMessageViewModel.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/publicChannels/concord/send/ConcordNewMessageViewModel.kt index ecd6dd4667..0361980ecb 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/publicChannels/concord/send/ConcordNewMessageViewModel.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/publicChannels/concord/send/ConcordNewMessageViewModel.kt @@ -133,7 +133,9 @@ open class ConcordNewMessageViewModel : ViewModel() { fun reply(note: Note) { replyTo.value = note replyMode.value = ReplyMode.INLINE - editingMessage.value = null + // Leaving edit mode drops the edited message's prefilled text too; kept, Send would + // post it again as a new reply. + if (editingMessage.value != null) cancelEdit() } /** Enter edit mode for my own [note]: prefills the field with its current text; sending publishes a kind-1010 edit. */