mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-04-02 13:45:10 -05:00
Ok now toggling logic is fixed
This commit is contained in:
parent
2de546fd52
commit
a61ea3555a
@ -104,11 +104,12 @@ export class FilterEditorViewService {
|
||||
let filterRules = this.filterRules
|
||||
let filterRuleType: FilterRuleType = FILTER_RULE_TYPES.find(t => t.id == filterRuleTypeID)
|
||||
let existingRules = filterRules.filter(rule => rule.type.id == filterRuleType.id)
|
||||
let existingItemRule = existingRules?.find(rule => rule.value == item.id)
|
||||
|
||||
if (existingRules && filterRuleType.id == FILTER_HAS_TAG) {
|
||||
let existingItemRule = existingRules?.find(rule => rule.value == item.id)
|
||||
if (existingItemRule) filterRules.splice(filterRules.indexOf(existingItemRule), 1)
|
||||
else filterRules.push({type: filterRuleType, value: item.id})
|
||||
if (existingRules && existingItemRule) {
|
||||
filterRules.splice(filterRules.indexOf(existingItemRule), 1) // if exact rule exists just remove
|
||||
} else if (existingItemRule && filterRuleType.multi) { // e.g. tags can have multiple
|
||||
filterRules.push({type: filterRuleType, value: item.id})
|
||||
} else if (existingRules.length) { // Correspondents & DocumentTypes only one
|
||||
filterRules.find(rule => rule.type.id == filterRuleType.id).value = item.id
|
||||
} else {
|
||||
|
Loading…
x
Reference in New Issue
Block a user