From 360970da85134f5e2d7dbf70c7e21ce89a83a2d6 Mon Sep 17 00:00:00 2001 From: Mykyta Maliarchuk <84377976+nikita-web-ua@users.noreply.github.com> Date: Thu, 22 Aug 2024 14:22:57 +0200 Subject: [PATCH] [ACS-6712] Fixed an issue where the details panel would not expand from the viewer (#4045) --- .../src/lib/store/effects/node.effects.spec.ts | 17 +++++++++++++++++ .../src/lib/store/effects/node.effects.ts | 12 ++---------- 2 files changed, 19 insertions(+), 10 deletions(-) diff --git a/projects/aca-content/src/lib/store/effects/node.effects.spec.ts b/projects/aca-content/src/lib/store/effects/node.effects.spec.ts index 2488c934f..091082ccb 100644 --- a/projects/aca-content/src/lib/store/effects/node.effects.spec.ts +++ b/projects/aca-content/src/lib/store/effects/node.effects.spec.ts @@ -38,6 +38,7 @@ import { ManageAspectsAction, ManagePermissionsAction, MoveNodesAction, + NavigateUrlAction, PrintFileAction, PurgeDeletedNodesAction, RestoreDeletedNodesAction, @@ -546,5 +547,21 @@ describe('NodeEffects', () => { }) ); }); + + it('should redirect to correct url', () => { + spyOn(store, 'dispatch').and.callThrough(); + Object.defineProperties(router, { + events: { + value: of(new NavigationEnd(1, 'test/(viewer:view/node-id)', '')) + }, + navigateByUrl: { + value: jasmine.createSpy('navigateByUrl') + } + }); + const node: any = { entry: { isFile: true, id: 'node-id' } }; + + store.dispatch(new ExpandInfoDrawerAction(node)); + expect(store.dispatch).toHaveBeenCalledWith(new NavigateUrlAction('personal-files/details/node-id')); + }); }); }); diff --git a/projects/aca-content/src/lib/store/effects/node.effects.ts b/projects/aca-content/src/lib/store/effects/node.effects.ts index 5b59fd6d5..bbd0b2afc 100644 --- a/projects/aca-content/src/lib/store/effects/node.effects.ts +++ b/projects/aca-content/src/lib/store/effects/node.effects.ts @@ -316,11 +316,7 @@ export class NodeEffects { .subscribe(() => this.store.dispatch(new SetInfoDrawerStateAction(true))); if (action?.payload) { const route = 'personal-files/details'; - this.router.navigate([route, action.payload.entry.id], { - queryParams: { - location: this.router.url - } - }); + this.store.dispatch(new NavigateUrlAction([route, action.payload.entry.id].join('/'))); } else { this.store .select(getAppSelection) @@ -328,11 +324,7 @@ export class NodeEffects { .subscribe((selection) => { if (selection && !selection.isEmpty) { const route = 'personal-files/details'; - this.router.navigate([route, selection.last.entry.id], { - queryParams: { - location: this.router.url - } - }); + this.store.dispatch(new NavigateUrlAction([route, selection.last.entry.id].join('/'))); } }); }