Fix unread badges and invite filtering

This commit is contained in:
Valere 2021-05-05 22:12:29 +02:00
parent 6220e35221
commit 506870302e
2 changed files with 5 additions and 42 deletions

View File

@ -166,10 +166,12 @@ class HomeDetailViewModel @AssistedInject constructor(@Assisted initialState: Ho
// TODO!!
}
is RoomGroupingMethod.BySpace -> {
val activeSpaceRoomId = groupingMethod.spaceSummary?.roomId
val dmInvites = session.getRoomSummaries(
roomSummaryQueryParams {
memberships = listOf(Membership.INVITE)
roomCategoryFilter = RoomCategoryFilter.ONLY_DM
activeSpaceId = activeSpaceRoomId?.let { ActiveSpaceFilter.ActiveSpace(it) } ?: ActiveSpaceFilter.None
}
).size
@ -177,6 +179,7 @@ class HomeDetailViewModel @AssistedInject constructor(@Assisted initialState: Ho
roomSummaryQueryParams {
memberships = listOf(Membership.INVITE)
roomCategoryFilter = RoomCategoryFilter.ONLY_ROOMS
activeSpaceId = ActiveSpaceFilter.ActiveSpace(groupingMethod.spaceSummary?.roomId)
}
).size
@ -184,6 +187,7 @@ class HomeDetailViewModel @AssistedInject constructor(@Assisted initialState: Ho
roomSummaryQueryParams {
memberships = listOf(Membership.JOIN)
roomCategoryFilter = RoomCategoryFilter.ONLY_DM
activeSpaceId = activeSpaceRoomId?.let { ActiveSpaceFilter.ActiveSpace(it) } ?: ActiveSpaceFilter.None
}
)

View File

@ -129,7 +129,7 @@ class SpaceRoomListSectionBuilder(
sections, activeSpaceAwareQueries,
R.string.invitations_header,
true,
RoomListViewModel.SpaceFilterStrategy.NONE
RoomListViewModel.SpaceFilterStrategy.NOT_IF_ALL
) {
it.memberships = listOf(Membership.INVITE)
it.roomCategoryFilter = RoomCategoryFilter.ONLY_ROOMS
@ -259,47 +259,6 @@ class SpaceRoomListSectionBuilder(
it.roomCategoryFilter = RoomCategoryFilter.ONLY_DM
it.roomTagQueryFilter = RoomTagQueryFilter(false, null, null)
}
// // For DMs we still need some post query filter :/
// // It's probably less important as home is not filtering at all
// val dmList = MutableLiveData<List<RoomSummary>>()
// Observables.combineLatest(
// session.getRoomSummariesLive(
// roomSummaryQueryParams {
// memberships = listOf(Membership.JOIN)
// roomCategoryFilter = RoomCategoryFilter.ONLY_DM
// }
// ).asObservable(),
// appStateHandler.selectedSpaceDataSource.observe()
//
// ) { rooms, currentSpaceOption ->
// val currentSpace = currentSpaceOption.orNull()
// .takeIf {
// // the +ALL trick is annoying, should find a way to fix that at the source!
// MatrixPatterns.isRoomId(it?.roomId)
// }
// if (currentSpace == null) {
// rooms
// } else {
// rooms.filter {
// it.otherMemberIds
// .intersect(currentSpace.otherMemberIds)
// .isNotEmpty()
// }
// }
// }.subscribe {
// dmList.postValue(it)
// }.also {
// onDisposable.invoke(it)
// }
//
// sections.add(
// RoomsSection(
// sectionName = stringProvider.getString(R.string.bottom_action_people_x),
// liveList = dmList,
// notifyOfLocalEcho = false
// )
// )
}
private fun addSection(sections: MutableList<RoomsSection>,