From e121b2849ca7fd3dc2db659ea89f753116a51be9 Mon Sep 17 00:00:00 2001 From: Vitor Pamplona Date: Fri, 12 Sep 2025 13:58:37 -0400 Subject: [PATCH] Fixes subject calculations on rendering --- .../com/vitorpamplona/amethyst/ui/note/types/Text.kt | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/Text.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/Text.kt index 28efb1f977..e1f60d664a 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/Text.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/Text.kt @@ -104,7 +104,6 @@ fun RenderTextEvent( note, accountViewModel, ) { body -> - val subject = (note.event as? TextNoteEvent)?.subject()?.ifEmpty { null } val newBody = if (editState.value is GenericLoadable.Loaded) { (editState.value as? GenericLoadable.Loaded) @@ -118,10 +117,13 @@ fun RenderTextEvent( } val eventContent = - if (!subject.isNullOrBlank() && !newBody.startsWith(subject)) { - "### $subject\n$newBody" - } else { - newBody + remember(newBody) { + val subject = (note.event as? TextNoteEvent)?.subject()?.ifBlank { null } + if (!subject.isNullOrBlank() && !newBody.contains(subject, ignoreCase = true)) { + "$subject\n\n$newBody" + } else { + newBody + } } if (makeItShort && accountViewModel.isLoggedUser(note.author)) {