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])) | ||||
|  | ||||
|     component.primaryAction(DataType.Document, object) | ||||
|     expect(routerSpy).toHaveBeenCalledWith(['/documents', object.id]) | ||||
|     expect(routerSpy).toHaveBeenCalledWith(['/documents', object.id], {}) | ||||
|  | ||||
|     component.primaryAction(DataType.SavedView, object) | ||||
|     expect(routerSpy).toHaveBeenCalledWith(['/view', object.id]) | ||||
|     expect(routerSpy).toHaveBeenCalledWith(['/view', object.id], {}) | ||||
|  | ||||
|     component.primaryAction(DataType.Correspondent, object) | ||||
|     expect(routerSpy).toHaveBeenCalledWith([ | ||||
|       '/documents', | ||||
|       queryParamsFromFilterRules([ | ||||
|     expect(routerSpy).toHaveBeenCalledWith(['/documents'], { | ||||
|       queryParams: queryParamsFromFilterRules([ | ||||
|         { | ||||
|           rule_type: FILTER_HAS_CORRESPONDENT_ANY, | ||||
|           value: object.id.toString(), | ||||
|         }, | ||||
|       ]), | ||||
|     ]) | ||||
|     }) | ||||
|  | ||||
|     component.primaryAction(DataType.DocumentType, object) | ||||
|     expect(routerSpy).toHaveBeenCalledWith([ | ||||
|       '/documents', | ||||
|       queryParamsFromFilterRules([ | ||||
|     expect(routerSpy).toHaveBeenCalledWith(['/documents'], { | ||||
|       queryParams: queryParamsFromFilterRules([ | ||||
|         { | ||||
|           rule_type: FILTER_HAS_DOCUMENT_TYPE_ANY, | ||||
|           value: object.id.toString(), | ||||
|         }, | ||||
|       ]), | ||||
|     ]) | ||||
|     }) | ||||
|  | ||||
|     component.primaryAction(DataType.StoragePath, object) | ||||
|     expect(routerSpy).toHaveBeenCalledWith([ | ||||
|       '/documents', | ||||
|       queryParamsFromFilterRules([ | ||||
|     expect(routerSpy).toHaveBeenCalledWith(['/documents'], { | ||||
|       queryParams: queryParamsFromFilterRules([ | ||||
|         { rule_type: FILTER_HAS_STORAGE_PATH_ANY, value: object.id.toString() }, | ||||
|       ]), | ||||
|     ]) | ||||
|     }) | ||||
|  | ||||
|     component.primaryAction(DataType.Tag, object) | ||||
|     expect(routerSpy).toHaveBeenCalledWith([ | ||||
|       '/documents', | ||||
|       queryParamsFromFilterRules([ | ||||
|     expect(routerSpy).toHaveBeenCalledWith(['/documents'], { | ||||
|       queryParams: queryParamsFromFilterRules([ | ||||
|         { rule_type: FILTER_HAS_TAGS_ANY, value: object.id.toString() }, | ||||
|       ]), | ||||
|     ]) | ||||
|     }) | ||||
|  | ||||
|     component.primaryAction(DataType.User, object) | ||||
|     expect(modalSpy).toHaveBeenCalledWith(UserEditDialogComponent, { | ||||
|   | ||||
| @@ -163,7 +163,9 @@ export class GlobalSearchComponent implements OnInit { | ||||
|       let params = queryParamsFromFilterRules([ | ||||
|         { rule_type: filterRuleType, value: object.id.toString() }, | ||||
|       ]) | ||||
|       this.navigateOrOpenInNewWindow(['/documents', params], newWindow) | ||||
|       this.navigateOrOpenInNewWindow(['/documents'], newWindow, { | ||||
|         queryParams: params, | ||||
|       }) | ||||
|     } else if (editDialogComponent) { | ||||
|       const modalRef: NgbModalRef = this.modalService.open( | ||||
|         editDialogComponent, | ||||
| @@ -378,12 +380,18 @@ export class GlobalSearchComponent implements OnInit { | ||||
|     this.reset(true) | ||||
|   } | ||||
|  | ||||
|   private navigateOrOpenInNewWindow(commands: any, newWindow: boolean = false) { | ||||
|   private navigateOrOpenInNewWindow( | ||||
|     commands: any, | ||||
|     newWindow: boolean = false, | ||||
|     extras: Object = {} | ||||
|   ) { | ||||
|     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') | ||||
|     } else { | ||||
|       this.router.navigate(commands) | ||||
|       this.router.navigate(commands, extras) | ||||
|     } | ||||
|   } | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 shamoon
					shamoon