mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-04-02 13:45:10 -05:00
Merge pull request #930 from paperless-ngx/fix-unassigned-filtering-query-params
Fix: unassigned query params ignored
This commit is contained in:
commit
2decae6586
@ -129,6 +129,8 @@ export function filterRulesFromQueryParams(queryParams: ParamMap) {
|
|||||||
const allFilterRuleQueryParams: string[] = FILTER_RULE_TYPES.map(
|
const allFilterRuleQueryParams: string[] = FILTER_RULE_TYPES.map(
|
||||||
(rt) => rt.filtervar
|
(rt) => rt.filtervar
|
||||||
)
|
)
|
||||||
|
.concat(FILTER_RULE_TYPES.map((rt) => rt.isnull_filtervar))
|
||||||
|
.filter((rt) => rt !== undefined)
|
||||||
|
|
||||||
// transform query params to filter rules
|
// transform query params to filter rules
|
||||||
let filterRulesFromQueryParams: FilterRule[] = []
|
let filterRulesFromQueryParams: FilterRule[] = []
|
||||||
@ -136,8 +138,11 @@ export function filterRulesFromQueryParams(queryParams: ParamMap) {
|
|||||||
.filter((frqp) => queryParams.has(frqp))
|
.filter((frqp) => queryParams.has(frqp))
|
||||||
.forEach((filterQueryParamName) => {
|
.forEach((filterQueryParamName) => {
|
||||||
const rule_type: FilterRuleType = FILTER_RULE_TYPES.find(
|
const rule_type: FilterRuleType = FILTER_RULE_TYPES.find(
|
||||||
(rt) => rt.filtervar == filterQueryParamName
|
(rt) =>
|
||||||
|
rt.filtervar == filterQueryParamName ||
|
||||||
|
rt.isnull_filtervar == filterQueryParamName
|
||||||
)
|
)
|
||||||
|
const isNullRuleType = rule_type.isnull_filtervar == filterQueryParamName
|
||||||
const valueURIComponent: string = queryParams.get(filterQueryParamName)
|
const valueURIComponent: string = queryParams.get(filterQueryParamName)
|
||||||
const filterQueryParamValues: string[] = rule_type.multi
|
const filterQueryParamValues: string[] = rule_type.multi
|
||||||
? valueURIComponent.split(',')
|
? valueURIComponent.split(',')
|
||||||
@ -148,7 +153,7 @@ export function filterRulesFromQueryParams(queryParams: ParamMap) {
|
|||||||
filterQueryParamValues.map((val) => {
|
filterQueryParamValues.map((val) => {
|
||||||
return {
|
return {
|
||||||
rule_type: rule_type.id,
|
rule_type: rule_type.id,
|
||||||
value: val,
|
value: isNullRuleType ? null : val,
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user