mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-30 14:23:55 +01:00
Null values are treated as "not hidden".
This commit is contained in:
parent
e78447d406
commit
75c1717c89
1 changed files with 113 additions and 114 deletions
|
|
@ -16,10 +16,10 @@ const val CATEGORY_NEEDING_CATEGORIES = "needing categories"
|
||||||
*/
|
*/
|
||||||
@Singleton
|
@Singleton
|
||||||
class CategoryClient
|
class CategoryClient
|
||||||
@Inject
|
@Inject
|
||||||
constructor(
|
constructor(
|
||||||
private val categoryInterface: CategoryInterface,
|
private val categoryInterface: CategoryInterface,
|
||||||
) : ContinuationClient<MwQueryResponse, CategoryItem>() {
|
) : ContinuationClient<MwQueryResponse, CategoryItem>() {
|
||||||
/**
|
/**
|
||||||
* Searches for categories containing the specified string.
|
* Searches for categories containing the specified string.
|
||||||
*
|
*
|
||||||
|
|
@ -124,9 +124,8 @@ class CategoryClient
|
||||||
}.map {
|
}.map {
|
||||||
it
|
it
|
||||||
.filter { page ->
|
.filter { page ->
|
||||||
// Null check is not redundant because some values could be null
|
// Null values are treated as "not hidden" for unit test mocks
|
||||||
// for mocks when running unit tests
|
!(page.categoryInfo()?.isHidden ?: false)
|
||||||
page.categoryInfo()?.isHidden != true
|
|
||||||
}.map {
|
}.map {
|
||||||
CategoryItem(
|
CategoryItem(
|
||||||
it.title().replace(CATEGORY_PREFIX, ""),
|
it.title().replace(CATEGORY_PREFIX, ""),
|
||||||
|
|
@ -136,4 +135,4 @@ class CategoryClient
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue