From 30cd04680c86818f5109e63329f018d15a60f2e0 Mon Sep 17 00:00:00 2001 From: Kgothatso Ngako Date: Sat, 2 May 2026 03:24:31 +0200 Subject: [PATCH] Remove even more stupid code --- .../database/model/intermdiate/LocalInReplyToNostrEvent.kt | 6 ++++++ .../database/model/intermdiate/LocalQuotedNostrEvent.kt | 2 +- .../database/model/intermdiate/LocalRepostedNostrEvent.kt | 2 +- .../compose/ui/composable/widgets/content/RichContent.kt | 6 +++--- .../compose/ui/composable/widgets/feed/TextNoteFeedItem.kt | 2 +- 5 files changed, 12 insertions(+), 6 deletions(-) diff --git a/composeApp/src/commonMain/kotlin/ac/cord/auxiliary/compose/database/model/intermdiate/LocalInReplyToNostrEvent.kt b/composeApp/src/commonMain/kotlin/ac/cord/auxiliary/compose/database/model/intermdiate/LocalInReplyToNostrEvent.kt index e11d89c0..f8f466da 100644 --- a/composeApp/src/commonMain/kotlin/ac/cord/auxiliary/compose/database/model/intermdiate/LocalInReplyToNostrEvent.kt +++ b/composeApp/src/commonMain/kotlin/ac/cord/auxiliary/compose/database/model/intermdiate/LocalInReplyToNostrEvent.kt @@ -38,6 +38,12 @@ data class LocalInReplyToNostrEvent( ) val profile: Profile?, + @Relation( + entity = Mention::class, + parentColumn = "inReplyToNostrEventId", + entityColumn = "mentioningNostrEventId", + ) + val mentionedProfiles: List = emptyList(), ) { @Composable fun RenderNotePreview() { diff --git a/composeApp/src/commonMain/kotlin/ac/cord/auxiliary/compose/database/model/intermdiate/LocalQuotedNostrEvent.kt b/composeApp/src/commonMain/kotlin/ac/cord/auxiliary/compose/database/model/intermdiate/LocalQuotedNostrEvent.kt index 6c655e43..e6fdcc70 100644 --- a/composeApp/src/commonMain/kotlin/ac/cord/auxiliary/compose/database/model/intermdiate/LocalQuotedNostrEvent.kt +++ b/composeApp/src/commonMain/kotlin/ac/cord/auxiliary/compose/database/model/intermdiate/LocalQuotedNostrEvent.kt @@ -43,7 +43,7 @@ data class LocalQuotedNostrEvent( parentColumn = "quotedNostrEventId", entityColumn = "mentioningNostrEventId", ) - val mentionedProfiles: List? = emptyList(), + val mentionedProfiles: List = emptyList(), ) { @Composable fun RenderNotePreview() { diff --git a/composeApp/src/commonMain/kotlin/ac/cord/auxiliary/compose/database/model/intermdiate/LocalRepostedNostrEvent.kt b/composeApp/src/commonMain/kotlin/ac/cord/auxiliary/compose/database/model/intermdiate/LocalRepostedNostrEvent.kt index 6d27e281..0f40c719 100644 --- a/composeApp/src/commonMain/kotlin/ac/cord/auxiliary/compose/database/model/intermdiate/LocalRepostedNostrEvent.kt +++ b/composeApp/src/commonMain/kotlin/ac/cord/auxiliary/compose/database/model/intermdiate/LocalRepostedNostrEvent.kt @@ -43,7 +43,7 @@ data class LocalRepostedNostrEvent( parentColumn = "repostedNostrEventId", entityColumn = "mentioningNostrEventId", ) - val mentionedProfiles: List? = emptyList(), + val mentionedProfiles: List = emptyList(), ) { @Composable fun RenderNotePreview() { diff --git a/composeApp/src/commonMain/kotlin/ac/cord/auxiliary/compose/ui/composable/widgets/content/RichContent.kt b/composeApp/src/commonMain/kotlin/ac/cord/auxiliary/compose/ui/composable/widgets/content/RichContent.kt index b75caf20..1549a728 100644 --- a/composeApp/src/commonMain/kotlin/ac/cord/auxiliary/compose/ui/composable/widgets/content/RichContent.kt +++ b/composeApp/src/commonMain/kotlin/ac/cord/auxiliary/compose/ui/composable/widgets/content/RichContent.kt @@ -35,7 +35,7 @@ import coil3.compose.AsyncImage fun RichContent( nostrEvent: NostrEvent, localQuotedNostrEvent: LocalQuotedNostrEvent?, - mentionedProfiles: List?, + mentionedProfiles: List, style: TextStyle = MaterialTheme.typography.bodyLarge, color: Color = MaterialTheme.colorScheme.onSurface, linkColor: Color = Color.Unspecified, @@ -110,10 +110,10 @@ fun RichContent( val profileNames = remember(profilePubkeys) { val names = mutableMapOf() - if (mentionedProfiles?.isNotEmpty() == true) { + if (mentionedProfiles.isNotEmpty()) { Logger.withTag("RichContent").d("mentionedProfiles: ${mentionedProfiles}") for (pubkey in profilePubkeys) { - val mentionedProfile = mentionedProfiles?.find { mentionedProfile -> mentionedProfile?.profile?.publicKey == pubkey } + val mentionedProfile = mentionedProfiles.find { mentionedProfile -> mentionedProfile.profile?.publicKey == pubkey } names[pubkey] = mentionedProfile?.profile?.humanReadableNameOrPubkey() ?: "${pubkey.take(8)}...${pubkey.takeLast(4)}" } diff --git a/composeApp/src/commonMain/kotlin/ac/cord/auxiliary/compose/ui/composable/widgets/feed/TextNoteFeedItem.kt b/composeApp/src/commonMain/kotlin/ac/cord/auxiliary/compose/ui/composable/widgets/feed/TextNoteFeedItem.kt index b1e1bc28..17c30514 100644 --- a/composeApp/src/commonMain/kotlin/ac/cord/auxiliary/compose/ui/composable/widgets/feed/TextNoteFeedItem.kt +++ b/composeApp/src/commonMain/kotlin/ac/cord/auxiliary/compose/ui/composable/widgets/feed/TextNoteFeedItem.kt @@ -36,7 +36,7 @@ internal fun TextNoteFeedItem( profile: Profile?, localInReplyToNostrEvent: LocalInReplyToNostrEvent?, localQuotedNostrEvent: LocalQuotedNostrEvent?, - mentionedProfiles: List?, + mentionedProfiles: List, onNavigateToEvent: (HexKey) -> Unit ) { if (localInReplyToNostrEvent != null) {