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
This commit is contained in:
+1
@@ -324,6 +324,7 @@ private fun MarkdownPostScreenBody(
|
|||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
.padding(horizontal = Size10dp, vertical = Size5dp),
|
.padding(horizontal = Size10dp, vertical = Size5dp),
|
||||||
singleLine = true,
|
singleLine = true,
|
||||||
|
enabled = !postViewModel.isEditing,
|
||||||
)
|
)
|
||||||
|
|
||||||
// Tags section
|
// Tags section
|
||||||
|
|||||||
+2
@@ -207,6 +207,8 @@ class LongFormPostViewModel :
|
|||||||
// Editing existing article
|
// Editing existing article
|
||||||
var existingDTag: String? = null
|
var existingDTag: String? = null
|
||||||
|
|
||||||
|
val isEditing: Boolean get() = existingDTag != null
|
||||||
|
|
||||||
fun init(accountVM: AccountViewModel) {
|
fun init(accountVM: AccountViewModel) {
|
||||||
this.accountViewModel = accountVM
|
this.accountViewModel = accountVM
|
||||||
this.account = accountVM.account
|
this.account = accountVM.account
|
||||||
|
|||||||
Reference in New Issue
Block a user