mirror of
				https://github.com/paperless-ngx/paperless-ngx.git
				synced 2025-11-03 19:17:13 -05:00 
			
		
		
		
	clickable fast filters now disregard any unapplied changes in the filter editor
This commit is contained in:
		
							parent
							
								
									a4f60c48ea
								
							
						
					
					
						commit
						282e6f453f
					
				@ -92,31 +92,41 @@ export class DocumentListComponent implements OnInit {
 | 
				
			|||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  filterByTag(t: PaperlessTag) {
 | 
					  filterByTag(t: PaperlessTag) {
 | 
				
			||||||
    if (this.filterRules.find(rule => rule.type.id == FILTER_HAS_TAG && rule.value == t.id)) {
 | 
					    let filterRules = this.list.filterRules
 | 
				
			||||||
 | 
					    if (filterRules.find(rule => rule.type.id == FILTER_HAS_TAG && rule.value == t.id)) {
 | 
				
			||||||
      return
 | 
					      return
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    this.filterRules.push({type: FILTER_RULE_TYPES.find(t => t.id == FILTER_HAS_TAG), value: t.id})
 | 
					    filterRules.push({type: FILTER_RULE_TYPES.find(t => t.id == FILTER_HAS_TAG), value: t.id})
 | 
				
			||||||
 | 
					    this.filterRules = filterRules
 | 
				
			||||||
    this.applyFilterRules()
 | 
					    this.applyFilterRules()
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  filterByCorrespondent(c: PaperlessCorrespondent) {
 | 
					  filterByCorrespondent(c: PaperlessCorrespondent) {
 | 
				
			||||||
    let existing_rule = this.filterRules.find(rule => rule.type.id == FILTER_CORRESPONDENT)
 | 
					    let filterRules = this.list.filterRules
 | 
				
			||||||
    if (existing_rule) {
 | 
					    let existing_rule = filterRules.find(rule => rule.type.id == FILTER_CORRESPONDENT)
 | 
				
			||||||
 | 
					    if (existing_rule && existing_rule.value == c.id) {
 | 
				
			||||||
 | 
					      return
 | 
				
			||||||
 | 
					    } else if (existing_rule) {
 | 
				
			||||||
      existing_rule.value = c.id
 | 
					      existing_rule.value = c.id
 | 
				
			||||||
    } else {
 | 
					    } else {
 | 
				
			||||||
      this.filterRules.push({type: FILTER_RULE_TYPES.find(t => t.id == FILTER_CORRESPONDENT), value: c.id})
 | 
					      filterRules.push({type: FILTER_RULE_TYPES.find(t => t.id == FILTER_CORRESPONDENT), value: c.id})
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					    this.filterRules = filterRules
 | 
				
			||||||
    this.applyFilterRules()
 | 
					    this.applyFilterRules()
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  filterByDocumentType(dt: PaperlessDocumentType) {
 | 
					  filterByDocumentType(dt: PaperlessDocumentType) {
 | 
				
			||||||
    let existing_rule = this.filterRules.find(rule => rule.type.id == FILTER_DOCUMENT_TYPE)
 | 
					    let filterRules = this.list.filterRules
 | 
				
			||||||
    if (existing_rule) {
 | 
					    let existing_rule = filterRules.find(rule => rule.type.id == FILTER_DOCUMENT_TYPE)
 | 
				
			||||||
 | 
					    if (existing_rule && existing_rule.value == dt.id) {
 | 
				
			||||||
 | 
					      return
 | 
				
			||||||
 | 
					    } else if (existing_rule) {
 | 
				
			||||||
      existing_rule.value = dt.id
 | 
					      existing_rule.value = dt.id
 | 
				
			||||||
    } else {
 | 
					    } else {
 | 
				
			||||||
      this.filterRules.push({type: FILTER_RULE_TYPES.find(t => t.id == FILTER_DOCUMENT_TYPE), value: dt.id})
 | 
					      filterRules.push({type: FILTER_RULE_TYPES.find(t => t.id == FILTER_DOCUMENT_TYPE), value: dt.id})
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					    this.filterRules = filterRules
 | 
				
			||||||
    this.applyFilterRules()
 | 
					    this.applyFilterRules()
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user