Simplifies the startWith check
This commit is contained in:
@@ -53,6 +53,7 @@ import com.vitorpamplona.quartz.nip10Notes.BaseThreadedEvent
|
|||||||
import com.vitorpamplona.quartz.nip10Notes.TextNoteEvent
|
import com.vitorpamplona.quartz.nip10Notes.TextNoteEvent
|
||||||
import com.vitorpamplona.quartz.nip14Subject.subject
|
import com.vitorpamplona.quartz.nip14Subject.subject
|
||||||
import com.vitorpamplona.quartz.nip72ModCommunities.definition.CommunityDefinitionEvent
|
import com.vitorpamplona.quartz.nip72ModCommunities.definition.CommunityDefinitionEvent
|
||||||
|
import org.apache.commons.lang3.StringUtils.startsWith
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun RenderTextEvent(
|
fun RenderTextEvent(
|
||||||
@@ -118,7 +119,7 @@ fun RenderTextEvent(
|
|||||||
}
|
}
|
||||||
|
|
||||||
val eventContent =
|
val eventContent =
|
||||||
if (!subject.isNullOrBlank() && !newBody.split("\n")[0].startsWith(subject)) {
|
if (!subject.isNullOrBlank() && !newBody.startsWith(subject)) {
|
||||||
"### $subject\n$newBody"
|
"### $subject\n$newBody"
|
||||||
} else {
|
} else {
|
||||||
newBody
|
newBody
|
||||||
|
|||||||
Reference in New Issue
Block a user