Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ACS-8677] Refresh document list after file version restore #4063

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading