Refactoring
This commit is contained in:
@@ -20,13 +20,11 @@ class ChatroomListKnownFeedFilter(val account: Account) : AdditiveFeedFilter<Not
|
|||||||
val me = account.userProfile()
|
val me = account.userProfile()
|
||||||
val followingKeySet = account.followingKeySet()
|
val followingKeySet = account.followingKeySet()
|
||||||
|
|
||||||
val messagingWith = me.privateChatrooms.filter {
|
val knownChatrooms = me.privateChatrooms.filter {
|
||||||
(
|
(it.value.senderIntersects(followingKeySet) || me.hasSentMessagesTo(it.key)) && !account.isAllHidden(it.key.users)
|
||||||
it.value.senderIntersects(followingKeySet) || me.hasSentMessagesTo(it.key)
|
|
||||||
) && !account.isAllHidden(it.key.users)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
val privateMessages = messagingWith.mapNotNull { it ->
|
val privateMessages = knownChatrooms.mapNotNull { it ->
|
||||||
it.value
|
it.value
|
||||||
.roomMessages
|
.roomMessages
|
||||||
.sortedWith(compareBy({ it.createdAt() }, { it.idHex }))
|
.sortedWith(compareBy({ it.createdAt() }, { it.idHex }))
|
||||||
|
|||||||
@@ -19,12 +19,11 @@ class ChatroomListNewFeedFilter(val account: Account) : AdditiveFeedFilter<Note>
|
|||||||
val me = account.userProfile()
|
val me = account.userProfile()
|
||||||
val followingKeySet = account.followingKeySet()
|
val followingKeySet = account.followingKeySet()
|
||||||
|
|
||||||
val privateChatrooms = account.userProfile().privateChatrooms
|
val newChatrooms = me.privateChatrooms.filter {
|
||||||
val messagingWith = privateChatrooms.filter {
|
|
||||||
!it.value.senderIntersects(followingKeySet) && !me.hasSentMessagesTo(it.key) && !account.isAllHidden(it.key.users)
|
!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
|
it.value
|
||||||
.roomMessages
|
.roomMessages
|
||||||
.sortedWith(compareBy({ it.createdAt() }, { it.idHex }))
|
.sortedWith(compareBy({ it.createdAt() }, { it.idHex }))
|
||||||
|
|||||||
Reference in New Issue
Block a user