From abf6cc00ae5f9a38b472687cbabac9e5e05b6d71 Mon Sep 17 00:00:00 2001 From: David Kaspar Date: Thu, 7 Nov 2024 09:24:30 +0000 Subject: [PATCH] test for empty string in mentions --- .../vitorpamplona/amethyst/ui/actions/NewPostViewModel.kt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/actions/NewPostViewModel.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/actions/NewPostViewModel.kt index 1bd8df1da..8491b4ae1 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/actions/NewPostViewModel.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/actions/NewPostViewModel.kt @@ -222,7 +222,10 @@ open class NewPostViewModel : ViewModel() { if (replyNote.event !is CommunityDefinitionEvent) { replyNote.author?.let { replyUser -> val currentMentions = - (replyNote.event as? TextNoteEvent)?.mentions()?.map { LocalCache.getOrCreateUser(it) } + (replyNote.event as? TextNoteEvent) + ?.mentions() + ?.filter { it.isNotEmpty() } + ?.map { LocalCache.getOrCreateUser(it) } ?: emptyList() if (currentMentions.contains(replyUser)) {