Skip to content

Commit

Permalink
[ACS-8677] refresh document list after file version restore (#4063)
Browse files Browse the repository at this point in the history
  • Loading branch information
nikita-web-ua committed Aug 30, 2024
1 parent 6450d6b commit 14b0173
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ import { MatDialog, MatDialogModule, MatDialogRef } from '@angular/material/dial
import { MatSnackBarModule, MatSnackBarRef, SimpleSnackBar } from '@angular/material/snack-bar';
import { Node, NodeEntry, VersionPaging } from '@alfresco/js-api';
import {
DocumentListService,
FileModel,
NewVersionUploaderDataAction,
NewVersionUploaderService,
Expand All @@ -74,6 +75,7 @@ describe('ContentManagementService', () => {
let contentManagementService: ContentManagementService;
let notificationService: NotificationService;
let nodeActions: NodeActionsService;
let documentListService: DocumentListService;
let translationService: TranslationService;
let nodesApiService: NodesApiService;
let nodeAspectService: NodeAspectService;
Expand All @@ -97,6 +99,7 @@ describe('ContentManagementService', () => {
showInfoSpy = spyOn(notificationService, 'showInfo');
showWarningSpy = spyOn(notificationService, 'showWarning');
nodeActions = TestBed.inject(NodeActionsService);
documentListService = TestBed.inject(DocumentListService);
translationService = TestBed.inject(TranslationService);
nodesApiService = TestBed.inject(NodesApiService);
nodeAspectService = TestBed.inject(NodeAspectService);
Expand Down Expand Up @@ -1578,10 +1581,12 @@ describe('ContentManagementService', () => {
expect(spyOnOpenUploadNewVersionDialog['calls'].argsFor(0)[2]).toEqual(elementToFocusSelector);
});

it('should dispatch RefreshPreviewAction if dialog emit refresh action', () => {
it('should dispatch RefreshPreviewAction and reload document list if dialog emit refresh action', () => {
spyOnOpenUploadNewVersionDialog.and.returnValue(of({ action: NewVersionUploaderDataAction.refresh, node: fakeNodeIsFile }));
spyOn(documentListService, 'reload');
contentManagementService.manageVersions(fakeNodeIsFile);

expect(documentListService.reload).toHaveBeenCalled();
expect(spyOnDispatch).toHaveBeenCalledOnceWith(new RefreshPreviewAction(fakeNodeIsFile));
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -578,6 +578,7 @@ export class ContentManagementService {
next: (newVersionUploaderData) => {
switch (newVersionUploaderData.action) {
case NewVersionUploaderDataAction.refresh:
this.documentListService.reload();
this.store.dispatch(new RefreshPreviewAction(newVersionUploaderData.node));
break;
case NewVersionUploaderDataAction.view:
Expand Down

0 comments on commit 14b0173

Please sign in to comment.