mirror of
				https://github.com/paperless-ngx/paperless-ngx.git
				synced 2025-10-30 03:56:23 -05:00 
			
		
		
		
	Fix: global search filtering links broken in 2.8.4 (#6726)
This commit is contained in:
		| @@ -287,48 +287,44 @@ describe('GlobalSearchComponent', () => { | |||||||
|     modalService.activeInstances.subscribe((m) => (modal = m[m.length - 1])) |     modalService.activeInstances.subscribe((m) => (modal = m[m.length - 1])) | ||||||
|  |  | ||||||
|     component.primaryAction(DataType.Document, object) |     component.primaryAction(DataType.Document, object) | ||||||
|     expect(routerSpy).toHaveBeenCalledWith(['/documents', object.id]) |     expect(routerSpy).toHaveBeenCalledWith(['/documents', object.id], {}) | ||||||
|  |  | ||||||
|     component.primaryAction(DataType.SavedView, object) |     component.primaryAction(DataType.SavedView, object) | ||||||
|     expect(routerSpy).toHaveBeenCalledWith(['/view', object.id]) |     expect(routerSpy).toHaveBeenCalledWith(['/view', object.id], {}) | ||||||
|  |  | ||||||
|     component.primaryAction(DataType.Correspondent, object) |     component.primaryAction(DataType.Correspondent, object) | ||||||
|     expect(routerSpy).toHaveBeenCalledWith([ |     expect(routerSpy).toHaveBeenCalledWith(['/documents'], { | ||||||
|       '/documents', |       queryParams: queryParamsFromFilterRules([ | ||||||
|       queryParamsFromFilterRules([ |  | ||||||
|         { |         { | ||||||
|           rule_type: FILTER_HAS_CORRESPONDENT_ANY, |           rule_type: FILTER_HAS_CORRESPONDENT_ANY, | ||||||
|           value: object.id.toString(), |           value: object.id.toString(), | ||||||
|         }, |         }, | ||||||
|       ]), |       ]), | ||||||
|     ]) |     }) | ||||||
|  |  | ||||||
|     component.primaryAction(DataType.DocumentType, object) |     component.primaryAction(DataType.DocumentType, object) | ||||||
|     expect(routerSpy).toHaveBeenCalledWith([ |     expect(routerSpy).toHaveBeenCalledWith(['/documents'], { | ||||||
|       '/documents', |       queryParams: queryParamsFromFilterRules([ | ||||||
|       queryParamsFromFilterRules([ |  | ||||||
|         { |         { | ||||||
|           rule_type: FILTER_HAS_DOCUMENT_TYPE_ANY, |           rule_type: FILTER_HAS_DOCUMENT_TYPE_ANY, | ||||||
|           value: object.id.toString(), |           value: object.id.toString(), | ||||||
|         }, |         }, | ||||||
|       ]), |       ]), | ||||||
|     ]) |     }) | ||||||
|  |  | ||||||
|     component.primaryAction(DataType.StoragePath, object) |     component.primaryAction(DataType.StoragePath, object) | ||||||
|     expect(routerSpy).toHaveBeenCalledWith([ |     expect(routerSpy).toHaveBeenCalledWith(['/documents'], { | ||||||
|       '/documents', |       queryParams: queryParamsFromFilterRules([ | ||||||
|       queryParamsFromFilterRules([ |  | ||||||
|         { rule_type: FILTER_HAS_STORAGE_PATH_ANY, value: object.id.toString() }, |         { rule_type: FILTER_HAS_STORAGE_PATH_ANY, value: object.id.toString() }, | ||||||
|       ]), |       ]), | ||||||
|     ]) |     }) | ||||||
|  |  | ||||||
|     component.primaryAction(DataType.Tag, object) |     component.primaryAction(DataType.Tag, object) | ||||||
|     expect(routerSpy).toHaveBeenCalledWith([ |     expect(routerSpy).toHaveBeenCalledWith(['/documents'], { | ||||||
|       '/documents', |       queryParams: queryParamsFromFilterRules([ | ||||||
|       queryParamsFromFilterRules([ |  | ||||||
|         { rule_type: FILTER_HAS_TAGS_ANY, value: object.id.toString() }, |         { rule_type: FILTER_HAS_TAGS_ANY, value: object.id.toString() }, | ||||||
|       ]), |       ]), | ||||||
|     ]) |     }) | ||||||
|  |  | ||||||
|     component.primaryAction(DataType.User, object) |     component.primaryAction(DataType.User, object) | ||||||
|     expect(modalSpy).toHaveBeenCalledWith(UserEditDialogComponent, { |     expect(modalSpy).toHaveBeenCalledWith(UserEditDialogComponent, { | ||||||
|   | |||||||
| @@ -163,7 +163,9 @@ export class GlobalSearchComponent implements OnInit { | |||||||
|       let params = queryParamsFromFilterRules([ |       let params = queryParamsFromFilterRules([ | ||||||
|         { rule_type: filterRuleType, value: object.id.toString() }, |         { rule_type: filterRuleType, value: object.id.toString() }, | ||||||
|       ]) |       ]) | ||||||
|       this.navigateOrOpenInNewWindow(['/documents', params], newWindow) |       this.navigateOrOpenInNewWindow(['/documents'], newWindow, { | ||||||
|  |         queryParams: params, | ||||||
|  |       }) | ||||||
|     } else if (editDialogComponent) { |     } else if (editDialogComponent) { | ||||||
|       const modalRef: NgbModalRef = this.modalService.open( |       const modalRef: NgbModalRef = this.modalService.open( | ||||||
|         editDialogComponent, |         editDialogComponent, | ||||||
| @@ -378,12 +380,18 @@ export class GlobalSearchComponent implements OnInit { | |||||||
|     this.reset(true) |     this.reset(true) | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   private navigateOrOpenInNewWindow(commands: any, newWindow: boolean = false) { |   private navigateOrOpenInNewWindow( | ||||||
|  |     commands: any, | ||||||
|  |     newWindow: boolean = false, | ||||||
|  |     extras: Object = {} | ||||||
|  |   ) { | ||||||
|     if (newWindow) { |     if (newWindow) { | ||||||
|       const url = this.router.serializeUrl(this.router.createUrlTree(commands)) |       const url = this.router.serializeUrl( | ||||||
|  |         this.router.createUrlTree(commands, extras) | ||||||
|  |       ) | ||||||
|       window.open(url, '_blank') |       window.open(url, '_blank') | ||||||
|     } else { |     } else { | ||||||
|       this.router.navigate(commands) |       this.router.navigate(commands, extras) | ||||||
|     } |     } | ||||||
|   } |   } | ||||||
| } | } | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 shamoon
					shamoon