Adding more constraints to the channel filter

This commit is contained in:
Vitor Pamplona
2025-05-05 19:11:54 -04:00
parent 1c23600c57
commit 49c131a5cd
@@ -54,15 +54,20 @@ class ChannelFinderFilterAssembler(
SincePerRelayFilter(
kinds = listOf(ChannelMetadataEvent.KIND),
tags = mapOf("e" to reactionsToWatch),
limit = 3,
),
)
}
fun createLoadEventsIfNotLoadedFilter(keys: Set<ChannelFinderQueryState>): TypedFilter? {
val directEventsToLoad =
keys.filter { it.channel.notes.isEmpty() && it.channel is PublicChatChannel }
val interestedEvents = (directEventsToLoad).map { it.channel.idHex }.toSet()
val interestedEvents =
keys.mapNotNullTo(mutableSetOf()) {
if (it.channel is PublicChatChannel && it.channel.event == null) {
it.channel.idHex
} else {
null
}
}
if (interestedEvents.isEmpty()) {
return null