From 7cf7c9f082df73aa2b94b176b9e0d374b8c8bf78 Mon Sep 17 00:00:00 2001 From: Vitor Pamplona Date: Thu, 14 Dec 2023 18:56:53 -0500 Subject: [PATCH] Refactoring --- .../amethyst/ui/dal/ChatroomListKnownFeedFilter.kt | 8 +++----- .../amethyst/ui/dal/ChatroomListNewFeedFilter.kt | 5 ++--- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/app/src/main/java/com/vitorpamplona/amethyst/ui/dal/ChatroomListKnownFeedFilter.kt b/app/src/main/java/com/vitorpamplona/amethyst/ui/dal/ChatroomListKnownFeedFilter.kt index 83543f85e..c14c8a4d8 100644 --- a/app/src/main/java/com/vitorpamplona/amethyst/ui/dal/ChatroomListKnownFeedFilter.kt +++ b/app/src/main/java/com/vitorpamplona/amethyst/ui/dal/ChatroomListKnownFeedFilter.kt @@ -20,13 +20,11 @@ class ChatroomListKnownFeedFilter(val account: Account) : AdditiveFeedFilter + val privateMessages = knownChatrooms.mapNotNull { it -> it.value .roomMessages .sortedWith(compareBy({ it.createdAt() }, { it.idHex })) diff --git a/app/src/main/java/com/vitorpamplona/amethyst/ui/dal/ChatroomListNewFeedFilter.kt b/app/src/main/java/com/vitorpamplona/amethyst/ui/dal/ChatroomListNewFeedFilter.kt index ab3e48e6e..7b3e760fa 100644 --- a/app/src/main/java/com/vitorpamplona/amethyst/ui/dal/ChatroomListNewFeedFilter.kt +++ b/app/src/main/java/com/vitorpamplona/amethyst/ui/dal/ChatroomListNewFeedFilter.kt @@ -19,12 +19,11 @@ class ChatroomListNewFeedFilter(val account: Account) : AdditiveFeedFilter val me = account.userProfile() val followingKeySet = account.followingKeySet() - val privateChatrooms = account.userProfile().privateChatrooms - val messagingWith = privateChatrooms.filter { + val newChatrooms = me.privateChatrooms.filter { !it.value.senderIntersects(followingKeySet) && !me.hasSentMessagesTo(it.key) && !account.isAllHidden(it.key.users) } - val privateMessages = messagingWith.mapNotNull { it -> + val privateMessages = newChatrooms.mapNotNull { it -> it.value .roomMessages .sortedWith(compareBy({ it.createdAt() }, { it.idHex }))