mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2025-11-10 21:16:46 +01:00
Fixes subject calculations on rendering
This commit is contained in:
@@ -104,7 +104,6 @@ fun RenderTextEvent(
|
|||||||
note,
|
note,
|
||||||
accountViewModel,
|
accountViewModel,
|
||||||
) { body ->
|
) { body ->
|
||||||
val subject = (note.event as? TextNoteEvent)?.subject()?.ifEmpty { null }
|
|
||||||
val newBody =
|
val newBody =
|
||||||
if (editState.value is GenericLoadable.Loaded) {
|
if (editState.value is GenericLoadable.Loaded) {
|
||||||
(editState.value as? GenericLoadable.Loaded)
|
(editState.value as? GenericLoadable.Loaded)
|
||||||
@@ -118,10 +117,13 @@ fun RenderTextEvent(
|
|||||||
}
|
}
|
||||||
|
|
||||||
val eventContent =
|
val eventContent =
|
||||||
if (!subject.isNullOrBlank() && !newBody.startsWith(subject)) {
|
remember(newBody) {
|
||||||
"### $subject\n$newBody"
|
val subject = (note.event as? TextNoteEvent)?.subject()?.ifBlank { null }
|
||||||
} else {
|
if (!subject.isNullOrBlank() && !newBody.contains(subject, ignoreCase = true)) {
|
||||||
newBody
|
"$subject\n\n$newBody"
|
||||||
|
} else {
|
||||||
|
newBody
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (makeItShort && accountViewModel.isLoggedUser(note.author)) {
|
if (makeItShort && accountViewModel.isLoggedUser(note.author)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user