Commit 50687030 authored by Valere's avatar Valere
Browse files

Fix unread badges and invite filtering

parent 6220e352
......@@ -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
}
)
......
......@@ -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>,
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment