Ensure proper grouping for notifications tab query

Change-Id: I58e8a85fd5e2c938d55189825daf7820f826da1e
This commit is contained in:
SpiritCroc 2021-05-05 12:31:20 +02:00
parent a66d6c42b5
commit 2f4e9e3017

View File

@ -256,7 +256,9 @@ internal class RoomSummaryDataSource @Inject constructor(@SessionDatabase privat
when (it) {
RoomCategoryFilter.ONLY_DM -> query.equalTo(RoomSummaryEntityFields.IS_DIRECT, true)
RoomCategoryFilter.ONLY_ROOMS -> query.equalTo(RoomSummaryEntityFields.IS_DIRECT, false)
RoomCategoryFilter.ONLY_WITH_NOTIFICATIONS -> query.greaterThan(RoomSummaryEntityFields.NOTIFICATION_COUNT, 0).or().equalTo(RoomSummaryEntityFields.MARKED_UNREAD, true)
RoomCategoryFilter.ONLY_WITH_NOTIFICATIONS -> query.beginGroup()
.greaterThan(RoomSummaryEntityFields.NOTIFICATION_COUNT, 0).or()
.equalTo(RoomSummaryEntityFields.MARKED_UNREAD, true).endGroup()
RoomCategoryFilter.ALL -> {
// nop
}
@ -283,7 +285,9 @@ internal class RoomSummaryDataSource @Inject constructor(@SessionDatabase privat
when (queryParams.roomCategoryFilter) {
RoomCategoryFilter.ONLY_DM -> query.equalTo(RoomSummaryEntityFields.IS_DIRECT, true)
RoomCategoryFilter.ONLY_ROOMS -> query.equalTo(RoomSummaryEntityFields.IS_DIRECT, false)
RoomCategoryFilter.ONLY_WITH_NOTIFICATIONS -> query.greaterThan(RoomSummaryEntityFields.NOTIFICATION_COUNT, 0)
RoomCategoryFilter.ONLY_WITH_NOTIFICATIONS -> query.beginGroup()
.greaterThan(RoomSummaryEntityFields.NOTIFICATION_COUNT, 0).or()
.equalTo(RoomSummaryEntityFields.MARKED_UNREAD, true).endGroup()
RoomCategoryFilter.ALL -> Unit // nop
}