Remove RoomCategoryFilter.ALL

Prefer nullability for API coherency of `RoomSummaryQueryParams`
This commit is contained in:
Benoit Marty 2022-05-24 15:50:27 +02:00 committed by Benoit Marty
parent 8d7a54a6cf
commit 8843fe0a54
5 changed files with 1 additions and 8 deletions

View file

@ -20,5 +20,4 @@ enum class RoomCategoryFilter {
ONLY_DM, ONLY_DM,
ONLY_ROOMS, ONLY_ROOMS,
ONLY_WITH_NOTIFICATIONS, ONLY_WITH_NOTIFICATIONS,
ALL
} }

View file

@ -66,7 +66,7 @@ data class RoomSummaryQueryParams(
var displayName: QueryStringValue = QueryStringValue.NoCondition var displayName: QueryStringValue = QueryStringValue.NoCondition
var canonicalAlias: QueryStringValue = QueryStringValue.NoCondition var canonicalAlias: QueryStringValue = QueryStringValue.NoCondition
var memberships: List<Membership> = Membership.all() var memberships: List<Membership> = Membership.all()
var roomCategoryFilter: RoomCategoryFilter? = RoomCategoryFilter.ALL var roomCategoryFilter: RoomCategoryFilter? = null
var roomTagQueryFilter: RoomTagQueryFilter? = null var roomTagQueryFilter: RoomTagQueryFilter? = null
var excludeType: List<String?>? = listOf(RoomType.SPACE) var excludeType: List<String?>? = listOf(RoomType.SPACE)
var includeType: List<String?>? = null var includeType: List<String?>? = null

View file

@ -279,9 +279,6 @@ internal class RoomSummaryDataSource @Inject constructor(
RoomCategoryFilter.ONLY_DM -> query.equalTo(RoomSummaryEntityFields.IS_DIRECT, true) RoomCategoryFilter.ONLY_DM -> query.equalTo(RoomSummaryEntityFields.IS_DIRECT, true)
RoomCategoryFilter.ONLY_ROOMS -> query.equalTo(RoomSummaryEntityFields.IS_DIRECT, false) RoomCategoryFilter.ONLY_ROOMS -> query.equalTo(RoomSummaryEntityFields.IS_DIRECT, false)
RoomCategoryFilter.ONLY_WITH_NOTIFICATIONS -> query.greaterThan(RoomSummaryEntityFields.NOTIFICATION_COUNT, 0) RoomCategoryFilter.ONLY_WITH_NOTIFICATIONS -> query.greaterThan(RoomSummaryEntityFields.NOTIFICATION_COUNT, 0)
RoomCategoryFilter.ALL -> {
// nop
}
} }
} }
queryParams.roomTagQueryFilter?.let { queryParams.roomTagQueryFilter?.let {
@ -306,7 +303,6 @@ internal class RoomSummaryDataSource @Inject constructor(
RoomCategoryFilter.ONLY_DM -> query.equalTo(RoomSummaryEntityFields.IS_DIRECT, true) RoomCategoryFilter.ONLY_DM -> query.equalTo(RoomSummaryEntityFields.IS_DIRECT, true)
RoomCategoryFilter.ONLY_ROOMS -> query.equalTo(RoomSummaryEntityFields.IS_DIRECT, false) RoomCategoryFilter.ONLY_ROOMS -> query.equalTo(RoomSummaryEntityFields.IS_DIRECT, false)
RoomCategoryFilter.ONLY_WITH_NOTIFICATIONS -> query.greaterThan(RoomSummaryEntityFields.NOTIFICATION_COUNT, 0) RoomCategoryFilter.ONLY_WITH_NOTIFICATIONS -> query.greaterThan(RoomSummaryEntityFields.NOTIFICATION_COUNT, 0)
RoomCategoryFilter.ALL -> Unit // nop
null -> Unit null -> Unit
} }

View file

@ -97,7 +97,6 @@ class RoomListSectionBuilderGroup(
true true
) { ) {
it.memberships = listOf(Membership.INVITE) it.memberships = listOf(Membership.INVITE)
it.roomCategoryFilter = RoomCategoryFilter.ALL
it.activeGroupId = actualGroupId it.activeGroupId = actualGroupId
} }
} }

View file

@ -298,7 +298,6 @@ class RoomListSectionBuilderSpace(
countRoomAsNotif = true countRoomAsNotif = true
) { ) {
it.memberships = listOf(Membership.INVITE) it.memberships = listOf(Membership.INVITE)
it.roomCategoryFilter = RoomCategoryFilter.ALL
} }
} }