Also filter threePids

This commit is contained in:
Benoit Marty 2020-10-02 22:16:13 +02:00
parent 9df3de2afb
commit f5580212ea
1 changed files with 10 additions and 2 deletions

View File

@ -59,7 +59,14 @@ class RoomMemberListController @Inject constructor(
roomMemberSummaryFilter.filter = data.filter roomMemberSummaryFilter.filter = data.filter
val roomMembersByPowerLevel = data.roomMemberSummaries.invoke() ?: return val roomMembersByPowerLevel = data.roomMemberSummaries.invoke() ?: return
val threePidInvites = data.threePidInvites().orEmpty() val threePidInvites = data.threePidInvites()
?.filter { event ->
event.content.toModel<RoomThirdPartyInviteContent>()
?.takeIf {
data.filter.isEmpty() || it.displayName.contains(data.filter, ignoreCase = true)
} != null
}
.orEmpty()
var threePidInvitesDone = threePidInvites.isEmpty() var threePidInvitesDone = threePidInvites.isEmpty()
for ((powerLevelCategory, roomMemberList) in roomMembersByPowerLevel) { for ((powerLevelCategory, roomMemberList) in roomMembersByPowerLevel) {
@ -100,12 +107,13 @@ class RoomMemberListController @Inject constructor(
} }
} }
) )
if (powerLevelCategory == RoomMemberListCategories.INVITE) { if (powerLevelCategory == RoomMemberListCategories.INVITE && !threePidInvitesDone) {
// Display the threepid invite after the regular invite // Display the threepid invite after the regular invite
dividerItem { dividerItem {
id("divider_threepidinvites") id("divider_threepidinvites")
color(dividerColor) color(dividerColor)
} }
buildThreePidInvites(data) buildThreePidInvites(data)
threePidInvitesDone = true threePidInvitesDone = true
} }