Inverts the name of the isFilledFilter function
This commit is contained in:
+1
-1
@@ -327,7 +327,7 @@ class QueryBuilder(
|
||||
filter: Filter,
|
||||
hasher: TagNameValueHasher,
|
||||
): QuerySpec? {
|
||||
if (!filter.isFilledFilter()) return null
|
||||
if (filter.isEmpty()) return null
|
||||
|
||||
val mustJoinSearch = (filter.search != null)
|
||||
|
||||
|
||||
+3
-3
@@ -35,10 +35,10 @@ class RelayBasedFilter(
|
||||
fun List<RelayBasedFilter>.groupByRelay(): Map<NormalizedRelayUrl, List<Filter>> {
|
||||
val result = mutableMapOf<NormalizedRelayUrl, MutableList<Filter>>()
|
||||
for (relayBasedFilter in this) {
|
||||
if (relayBasedFilter.filter.isFilledFilter()) {
|
||||
result.getOrPut(relayBasedFilter.relay) { mutableListOf() }.add(relayBasedFilter.filter)
|
||||
} else {
|
||||
if (relayBasedFilter.filter.isEmpty()) {
|
||||
Log.e("FilterError", "Ignoring empty filter for ${relayBasedFilter.relay}")
|
||||
} else {
|
||||
result.getOrPut(relayBasedFilter.relay) { mutableListOf() }.add(relayBasedFilter.filter)
|
||||
}
|
||||
}
|
||||
return result
|
||||
|
||||
+11
-11
@@ -74,18 +74,18 @@ class Filter(
|
||||
) = Filter(ids, authors, kinds, tags, tagsAll, since, until, limit, search)
|
||||
|
||||
/**
|
||||
* Returns true if this filter contains any non-null and non-empty criteria.
|
||||
* Returns true if this filter doesn't filter for anything.
|
||||
*/
|
||||
fun isFilledFilter() =
|
||||
(ids != null && ids.isNotEmpty()) ||
|
||||
(authors != null && authors.isNotEmpty()) ||
|
||||
(kinds != null && kinds.isNotEmpty()) ||
|
||||
(tags != null && tags.isNotEmpty() && tags.values.all { it.isNotEmpty() }) ||
|
||||
(tagsAll != null && tagsAll.isNotEmpty() && tagsAll.values.all { it.isNotEmpty() }) ||
|
||||
(since != null) ||
|
||||
(until != null) ||
|
||||
(limit != null) ||
|
||||
(search != null && search.isNotEmpty())
|
||||
fun isEmpty() =
|
||||
(ids == null || ids.isEmpty()) &&
|
||||
(authors == null || authors.isEmpty()) &&
|
||||
(kinds == null || kinds.isEmpty()) &&
|
||||
(tags == null || tags.isEmpty() && tags.values.all { it.isNotEmpty() }) &&
|
||||
(tagsAll == null || tagsAll.isEmpty() && tagsAll.values.all { it.isNotEmpty() }) &&
|
||||
(since == null) &&
|
||||
(until == null) &&
|
||||
(limit == null) &&
|
||||
(search == null || search.isEmpty())
|
||||
|
||||
init {
|
||||
ids?.forEach {
|
||||
|
||||
Reference in New Issue
Block a user