Activate edits for Articles.

This commit is contained in:
Vitor Pamplona
2026-03-22 14:47:27 -04:00
parent 9c30e2d0f6
commit b2f7c3296f
3 changed files with 29 additions and 14 deletions
@@ -232,7 +232,8 @@ fun NoteDropDownMenu(
nav.nav { routeEditDraftTo(note, accountViewModel.account) } nav.nav { routeEditDraftTo(note, accountViewModel.account) }
} }
} }
if (note.event is TextNoteEvent && !note.isDraft()) { if (!note.isDraft()) {
if (note.event is TextNoteEvent) {
if (state.isLoggedUser) { if (state.isLoggedUser) {
M3ActionRow(icon = Icons.Outlined.Edit, text = stringRes(R.string.edit_post)) { M3ActionRow(icon = Icons.Outlined.Edit, text = stringRes(R.string.edit_post)) {
wantsToEditPost.value = true wantsToEditPost.value = true
@@ -242,6 +243,11 @@ fun NoteDropDownMenu(
wantsToEditPost.value = true wantsToEditPost.value = true
} }
} }
} else if (note.event is LongTextNoteEvent && state.isLoggedUser) {
M3ActionRow(icon = Icons.Outlined.Edit, text = stringRes(R.string.edit_article)) {
nav.nav { Route.NewLongFormPost(version = note.idHex) }
}
}
} }
M3ActionRow(icon = Icons.Outlined.CellTower, text = stringRes(R.string.broadcast)) { M3ActionRow(icon = Icons.Outlined.CellTower, text = stringRes(R.string.broadcast)) {
accountViewModel.broadcast(note) accountViewModel.broadcast(note)
@@ -55,6 +55,7 @@ import com.vitorpamplona.amethyst.ui.components.M3ActionDialog
import com.vitorpamplona.amethyst.ui.components.M3ActionRow import com.vitorpamplona.amethyst.ui.components.M3ActionRow
import com.vitorpamplona.amethyst.ui.components.M3ActionSection import com.vitorpamplona.amethyst.ui.components.M3ActionSection
import com.vitorpamplona.amethyst.ui.navigation.navs.INav import com.vitorpamplona.amethyst.ui.navigation.navs.INav
import com.vitorpamplona.amethyst.ui.navigation.routes.Route
import com.vitorpamplona.amethyst.ui.navigation.routes.routeEditDraftTo import com.vitorpamplona.amethyst.ui.navigation.routes.routeEditDraftTo
import com.vitorpamplona.amethyst.ui.note.VerticalDotsIcon import com.vitorpamplona.amethyst.ui.note.VerticalDotsIcon
import com.vitorpamplona.amethyst.ui.note.elements.DropDownParams import com.vitorpamplona.amethyst.ui.note.elements.DropDownParams
@@ -66,6 +67,7 @@ import com.vitorpamplona.amethyst.ui.screen.loggedIn.report.ReportNoteDialog
import com.vitorpamplona.amethyst.ui.stringRes import com.vitorpamplona.amethyst.ui.stringRes
import com.vitorpamplona.amethyst.ui.theme.Size24Modifier import com.vitorpamplona.amethyst.ui.theme.Size24Modifier
import com.vitorpamplona.quartz.nip10Notes.TextNoteEvent import com.vitorpamplona.quartz.nip10Notes.TextNoteEvent
import com.vitorpamplona.quartz.nip23LongContent.LongTextNoteEvent
import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
@@ -248,7 +250,8 @@ fun BookmarkGroupItemOptionsMenu(
} }
} }
} }
if (note.event is TextNoteEvent && !note.isDraft()) { if (!note.isDraft()) {
if (note.event is TextNoteEvent) {
if (state.isLoggedUser) { if (state.isLoggedUser) {
M3ActionRow(icon = Icons.Outlined.Edit, text = stringRes(R.string.edit_post)) { M3ActionRow(icon = Icons.Outlined.Edit, text = stringRes(R.string.edit_post)) {
wantsToEditPost.value = true wantsToEditPost.value = true
@@ -258,6 +261,11 @@ fun BookmarkGroupItemOptionsMenu(
wantsToEditPost.value = true wantsToEditPost.value = true
} }
} }
} else if (note.event is LongTextNoteEvent && state.isLoggedUser) {
M3ActionRow(icon = Icons.Outlined.Edit, text = stringRes(R.string.edit_article)) {
nav.nav { Route.NewLongFormPost(version = note.idHex) }
}
}
} }
M3ActionRow(icon = Icons.Outlined.CellTower, text = stringRes(R.string.broadcast)) { M3ActionRow(icon = Icons.Outlined.CellTower, text = stringRes(R.string.broadcast)) {
accountViewModel.broadcast(note) accountViewModel.broadcast(note)
+1
View File
@@ -1467,6 +1467,7 @@
<string name="ots_info_title">Timestamp Proof</string> <string name="ots_info_title">Timestamp Proof</string>
<string name="ots_info_description">There\'s proof this post was signed sometime before %1$s. The proof was stamped in the Bitcoin blockchain at that date and time.</string> <string name="ots_info_description">There\'s proof this post was signed sometime before %1$s. The proof was stamped in the Bitcoin blockchain at that date and time.</string>
<string name="edit_article">Edit Article</string>
<string name="edit_post">Edit Post</string> <string name="edit_post">Edit Post</string>
<string name="proposal_to_edit">Proposal to improve a post</string> <string name="proposal_to_edit">Proposal to improve a post</string>
<string name="message_to_author">Summary of changes</string> <string name="message_to_author">Summary of changes</string>