diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/rooms/datasource/FilterFollowingPublicChats.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/rooms/datasource/FilterFollowingPublicChats.kt index e836d3d95..a085e5d76 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/rooms/datasource/FilterFollowingPublicChats.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/rooms/datasource/FilterFollowingPublicChats.kt @@ -29,7 +29,7 @@ import com.vitorpamplona.quartz.nip01Core.relay.filters.Filter import com.vitorpamplona.quartz.nip28PublicChat.admin.ChannelCreateEvent import com.vitorpamplona.quartz.utils.mapOfSet -fun filterFollowingPublicChats( +fun filterFollowingPublicChatsCreationEvent( followingChannels: Set, since: SincePerRelayMap?, ): List? { @@ -38,13 +38,16 @@ fun filterFollowingPublicChats( val relayRoomDTags = mapOfSet { followingChannels.forEach { channelId -> - val relays = - LocalCache.getPublicChatChannelIfExists(channelId)?.relays() - ?: LocalCache.relayHints.hintsForEvent(channelId).ifEmpty { null } - ?: Constants.eventFinderRelays + val channel = LocalCache.getPublicChatChannelIfExists(channelId) + if (channel?.event == null) { + val relays = + channel?.relays()?.ifEmpty { null } + ?: LocalCache.relayHints.hintsForEvent(channelId).ifEmpty { null } + ?: Constants.eventFinderRelays - relays.forEach { relayUrl -> - add(relayUrl, channelId) + relays.forEach { relayUrl -> + add(relayUrl, channelId) + } } } } diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/rooms/datasource/FilterLastMessageFollowingPublicChats.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/rooms/datasource/FilterLastMessageFollowingPublicChats.kt index 0c9c83141..8b8679956 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/rooms/datasource/FilterLastMessageFollowingPublicChats.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/rooms/datasource/FilterLastMessageFollowingPublicChats.kt @@ -40,7 +40,7 @@ fun filterLastMessageFollowingPublicChats( mapOfSet { followingChannels.forEach { channelId -> val relays = - LocalCache.getPublicChatChannelIfExists(channelId)?.relays() + LocalCache.getPublicChatChannelIfExists(channelId)?.relays()?.ifEmpty { null } ?: LocalCache.relayHints.hintsForEvent(channelId).ifEmpty { null } ?: Constants.eventFinderRelays diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/rooms/datasource/FollowingPublicChatSubAssembler.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/rooms/datasource/FollowingPublicChatSubAssembler.kt index a59c0fdc5..4f3c10bcc 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/rooms/datasource/FollowingPublicChatSubAssembler.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/rooms/datasource/FollowingPublicChatSubAssembler.kt @@ -43,7 +43,7 @@ class FollowingPublicChatSubAssembler( ): List? = listOfNotNull( filterLastMessageFollowingPublicChats(key.account.publicChatList.flowSet.value, since), - filterFollowingPublicChats(key.account.publicChatList.flowSet.value, since), + filterFollowingPublicChatsCreationEvent(key.account.publicChatList.flowSet.value, since), ).flatten() override fun user(key: ChatroomListState) = key.account.userProfile()