mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2026-08-12 01:07:46 +00:00
fix(chats): dedupe public channels in known list by channel id
ChatroomListKnownFeedFilter.feed() iterated account.publicChatList.flow, a Set<ChannelTag>. ChannelTag uses identity equality (it's not a data class) and the set is built from raw tag parsing, so a channel list that names the same channel id twice (e.g., the same channel appearing in the public section and the encrypted private section, or repeated with different relay hints) produces multiple ChannelTag entries for the same channel. Each one resolved to the same newest Note via getOrCreatePublicChatChannel(it.eventId), so the feed contained the same Note twice and the chat list LazyColumn crashed with "Key PublicChannelLazyKey(channelId=...) was already used". Use the sibling flowSet (Set<HexKey>, already deduped by event id), which is the same source filterRelevantPublicMessages reads from.
This commit is contained in:
+3
-3
@@ -55,10 +55,10 @@ class ChatroomListKnownFeedFilter(
|
||||
|
||||
val publicChannels =
|
||||
account
|
||||
.publicChatList.flow.value
|
||||
.mapNotNull { it ->
|
||||
.publicChatList.flowSet.value
|
||||
.mapNotNull { channelId ->
|
||||
LocalCache
|
||||
.getOrCreatePublicChatChannel(it.eventId)
|
||||
.getOrCreatePublicChatChannel(channelId)
|
||||
.notes
|
||||
.filter { _, it -> account.isAcceptable(it) && it.event != null }
|
||||
.sortedWith(DefaultFeedOrder)
|
||||
|
||||
Reference in New Issue
Block a user