From eb19fc69ae7717715ed6ad5289246ba2114cd206 Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 2 Apr 2026 14:50:51 +0000 Subject: [PATCH] fix: disable slug field when editing an existing article The d-tag is the article's identity in Nostr addressable events. Changing it on edit would create a new article instead of updating the existing one. The slug field is now disabled when isEditing is true. https://claude.ai/code/session_011JuQbdA12WdPxC7aGvUBqJ --- .../loggedIn/discover/nip23LongForm/LongFormPostScreen.kt | 1 + .../loggedIn/discover/nip23LongForm/LongFormPostViewModel.kt | 2 ++ 2 files changed, 3 insertions(+) diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/discover/nip23LongForm/LongFormPostScreen.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/discover/nip23LongForm/LongFormPostScreen.kt index 6ebd295dc..f72e7a1c4 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/discover/nip23LongForm/LongFormPostScreen.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/discover/nip23LongForm/LongFormPostScreen.kt @@ -324,6 +324,7 @@ private fun MarkdownPostScreenBody( .fillMaxWidth() .padding(horizontal = Size10dp, vertical = Size5dp), singleLine = true, + enabled = !postViewModel.isEditing, ) // Tags section diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/discover/nip23LongForm/LongFormPostViewModel.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/discover/nip23LongForm/LongFormPostViewModel.kt index 7c05abdc7..26e2e7918 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/discover/nip23LongForm/LongFormPostViewModel.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/discover/nip23LongForm/LongFormPostViewModel.kt @@ -207,6 +207,8 @@ class LongFormPostViewModel : // Editing existing article var existingDTag: String? = null + val isEditing: Boolean get() = existingDTag != null + fun init(accountVM: AccountViewModel) { this.accountViewModel = accountVM this.account = accountVM.account