Skip to content

A community-supported supercharged document management system: scan, index and archive all your documents

Fix: global search filtering links broken in 2.8.4 (#6726)

shamoon2ac5407dd464
diff --git a/src-ui/src/app/components/app-frame/global-search/global-search.component.spec.ts b/src-ui/src/app/components/app-frame/global-search/global-search.component.spec.ts
index 54ea735b6..20e39ee57 100644
--- a/src-ui/src/app/components/app-frame/global-search/global-search.component.spec.ts
+++ b/src-ui/src/app/components/app-frame/global-search/global-search.component.spec.ts
@@ -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, {
diff --git a/src-ui/src/app/components/app-frame/global-search/global-search.component.ts b/src-ui/src/app/components/app-frame/global-search/global-search.component.ts
index 2b1a078c4..837a8f39d 100644
--- a/src-ui/src/app/components/app-frame/global-search/global-search.component.ts
+++ b/src-ui/src/app/components/app-frame/global-search/global-search.component.ts
@@ -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)
}
}
}