[ACS-6573] Manage permissions window can now be opened from inside file preview (#3596)

* [ACS-6573] Resolved issue where manage permissions window could not be opened when opened from inside file preview

* [ACS-6573] Fixed unit test
This commit is contained in:
swapnil-verma-gl 2024-01-12 22:12:43 +05:30 committed by GitHub
parent 53245d6d6f
commit dc2c7c9109
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 7 deletions

View File

@ -381,19 +381,19 @@ describe('NodeEffects', () => {
describe('managePermissions$', () => {
it('should manage permissions from the payload', () => {
spyOn(router, 'navigate').and.stub();
spyOn(router, 'navigateByUrl').and.stub();
const node: any = { entry: { isFile: true, id: 'fileId' } };
store.dispatch(new ManagePermissionsAction(node));
expect(router.navigate).toHaveBeenCalledWith(['personal-files/details', 'fileId', 'permissions']);
expect(router.navigateByUrl).toHaveBeenCalledWith('personal-files/details/fileId/permissions');
});
it('should manage permissions from the active selection', () => {
spyOn(store, 'select').and.returnValue(of({ isEmpty: false, last: { entry: { id: 'fileId' } } }));
spyOn(router, 'navigate').and.stub();
spyOn(router, 'navigateByUrl').and.stub();
store.dispatch(new ManagePermissionsAction(null));
expect(router.navigate).toHaveBeenCalledWith(['personal-files/details', 'fileId', 'permissions']);
expect(router.navigateByUrl).toHaveBeenCalledWith('personal-files/details/fileId/permissions');
});
it('should do nothing if invoking manage permissions with no data', () => {

View File

@ -50,7 +50,8 @@ import {
ExpandInfoDrawerAction,
ManageRulesAction,
ShowLoaderAction,
ToggleInfoDrawerAction
ToggleInfoDrawerAction,
NavigateUrlAction
} from '@alfresco/aca-shared/store';
import { ContentManagementService } from '../../services/content-management.service';
import { RenditionService } from '@alfresco/adf-content-services';
@ -285,7 +286,7 @@ export class NodeEffects {
map((action) => {
if (action?.payload) {
const route = 'personal-files/details';
this.store.dispatch(new NavigateRouteAction([route, action.payload.entry.id, 'permissions']));
this.store.dispatch(new NavigateUrlAction([route, action.payload.entry.id, 'permissions'].join('/')));
} else {
this.store
.select(getAppSelection)
@ -293,7 +294,7 @@ export class NodeEffects {
.subscribe((selection) => {
if (selection && !selection.isEmpty) {
const route = 'personal-files/details';
this.store.dispatch(new NavigateRouteAction([route, selection.last.entry.id, 'permissions']));
this.store.dispatch(new NavigateUrlAction([route, selection.last.entry.id, 'permissions'].join('/')));
}
});
}