mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2025-10-10 07:43:41 +02:00
Fixes unable to see original post when clicking on the edit button
This commit is contained in:
@@ -100,23 +100,24 @@ fun RenderTextEvent(
|
|||||||
note,
|
note,
|
||||||
accountViewModel,
|
accountViewModel,
|
||||||
) { body ->
|
) { body ->
|
||||||
val eventContent =
|
val subject = (note.event as? TextNoteEvent)?.subject()?.ifEmpty { null }
|
||||||
remember(note.event) {
|
val newBody =
|
||||||
val subject = (note.event as? TextNoteEvent)?.subject()?.ifEmpty { null }
|
if (editState.value is GenericLoadable.Loaded) {
|
||||||
val newBody =
|
(editState.value as? GenericLoadable.Loaded)
|
||||||
if (editState.value is GenericLoadable.Loaded) {
|
?.loaded
|
||||||
val state =
|
?.modificationToShow
|
||||||
(editState.value as? GenericLoadable.Loaded)?.loaded?.modificationToShow
|
?.value
|
||||||
state?.value?.event?.content() ?: body
|
?.event
|
||||||
} else {
|
?.content() ?: body
|
||||||
body
|
} else {
|
||||||
}
|
body
|
||||||
|
}
|
||||||
|
|
||||||
if (!subject.isNullOrBlank() && !newBody.split("\n")[0].contains(subject)) {
|
val eventContent =
|
||||||
"### $subject\n$newBody"
|
if (!subject.isNullOrBlank() && !newBody.split("\n")[0].startsWith(subject)) {
|
||||||
} else {
|
"### $subject\n$newBody"
|
||||||
newBody
|
} else {
|
||||||
}
|
newBody
|
||||||
}
|
}
|
||||||
|
|
||||||
if (makeItShort && accountViewModel.isLoggedUser(note.author)) {
|
if (makeItShort && accountViewModel.isLoggedUser(note.author)) {
|
||||||
@@ -141,7 +142,14 @@ fun RenderTextEvent(
|
|||||||
modifier = Modifier.fillMaxWidth(),
|
modifier = Modifier.fillMaxWidth(),
|
||||||
tags = tags,
|
tags = tags,
|
||||||
backgroundColor = backgroundColor,
|
backgroundColor = backgroundColor,
|
||||||
id = note.idHex,
|
id =
|
||||||
|
if (editState.value is GenericLoadable.Loaded) {
|
||||||
|
(editState.value as GenericLoadable.Loaded<EditState>)
|
||||||
|
.loaded.modificationToShow.value
|
||||||
|
?.idHex ?: note.idHex
|
||||||
|
} else {
|
||||||
|
note.idHex
|
||||||
|
},
|
||||||
callbackUri = note.toNostrUri(),
|
callbackUri = note.toNostrUri(),
|
||||||
accountViewModel = accountViewModel,
|
accountViewModel = accountViewModel,
|
||||||
nav = nav,
|
nav = nav,
|
||||||
|
@@ -82,7 +82,7 @@ fun TranslatableRichTextViewer(
|
|||||||
nav: (String) -> Unit,
|
nav: (String) -> Unit,
|
||||||
) {
|
) {
|
||||||
var translatedTextState by
|
var translatedTextState by
|
||||||
remember(id, content.length) { mutableStateOf(TranslationConfig(content, null, null, false)) }
|
remember(id) { mutableStateOf(TranslationConfig(content, null, null, false)) }
|
||||||
|
|
||||||
TranslateAndWatchLanguageChanges(content, accountViewModel) { result ->
|
TranslateAndWatchLanguageChanges(content, accountViewModel) { result ->
|
||||||
if (
|
if (
|
||||||
|
Reference in New Issue
Block a user