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( SincePerRelayFilter(
kinds = listOf(ChannelMetadataEvent.KIND), kinds = listOf(ChannelMetadataEvent.KIND),
tags = mapOf("e" to reactionsToWatch), tags = mapOf("e" to reactionsToWatch),
limit = 3,
), ),
) )
} }
fun createLoadEventsIfNotLoadedFilter(keys: Set<ChannelFinderQueryState>): TypedFilter? { fun createLoadEventsIfNotLoadedFilter(keys: Set<ChannelFinderQueryState>): TypedFilter? {
val directEventsToLoad = val interestedEvents =
keys.filter { it.channel.notes.isEmpty() && it.channel is PublicChatChannel } keys.mapNotNullTo(mutableSetOf()) {
if (it.channel is PublicChatChannel && it.channel.event == null) {
val interestedEvents = (directEventsToLoad).map { it.channel.idHex }.toSet() it.channel.idHex
} else {
null
}
}
if (interestedEvents.isEmpty()) { if (interestedEvents.isEmpty()) {
return null return null