mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2026-08-11 08:47:33 +00:00
fix: open edit-draft screen when tapping a draft in ThreadView
Tapping a note in the thread view toggles the collapse/expand state of its children. For the user's own drafts, tap now opens the edit-draft screen (via routeEditDraftTo) so the post can be resumed, matching the behavior everywhere else a draft is tapped. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VQCNuxdYkfouNN3ujxm3mR
This commit is contained in:
+19
-2
@@ -95,6 +95,7 @@ import com.vitorpamplona.amethyst.ui.components.ZoomableContentView
|
||||
import com.vitorpamplona.amethyst.ui.feeds.RefresheableBox
|
||||
import com.vitorpamplona.amethyst.ui.navigation.navs.EmptyNav
|
||||
import com.vitorpamplona.amethyst.ui.navigation.navs.INav
|
||||
import com.vitorpamplona.amethyst.ui.navigation.routes.routeEditDraftTo
|
||||
import com.vitorpamplona.amethyst.ui.navigation.routes.routeFor
|
||||
import com.vitorpamplona.amethyst.ui.navigation.routes.routeToMessage
|
||||
import com.vitorpamplona.amethyst.ui.note.CheckAndDisplayEditStatus
|
||||
@@ -512,7 +513,23 @@ fun RenderThreadFeed(
|
||||
if (item.idHex == noteId) mutableStateOf(selectedNoteColor) else null
|
||||
}
|
||||
|
||||
val onCollapse = remember(item) { { viewModel.toggleCollapsed(item.idHex) } }
|
||||
// Tapping a reply collapses/expands its children, except for the user's own
|
||||
// drafts: those open the edit-draft screen so the post can be resumed, matching
|
||||
// the behavior everywhere else a draft is tapped.
|
||||
val onClick =
|
||||
remember(item) {
|
||||
{
|
||||
if (item.isDraft()) {
|
||||
nav.nav {
|
||||
withContext(Dispatchers.IO) {
|
||||
routeEditDraftTo(item, accountViewModel.account)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
viewModel.toggleCollapsed(item.idHex)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
NoteCompose(
|
||||
baseNote = item,
|
||||
@@ -523,7 +540,7 @@ fun RenderThreadFeed(
|
||||
parentBackgroundColor = background,
|
||||
accountViewModel = accountViewModel,
|
||||
nav = nav,
|
||||
onClick = onCollapse,
|
||||
onClick = onClick,
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user