@@ -48,15 +48,15 @@ import {
4848 NodesApiService ,
4949 ShareDialogComponent
5050} from '@alfresco/adf-content-services' ;
51- import { NotificationService , TranslationService , ConfirmDialogComponent , DialogComponent , DialogSize } from '@alfresco/adf-core' ;
51+ import { ConfirmDialogComponent , DialogComponent , DialogSize , NotificationService , TranslationService } from '@alfresco/adf-core' ;
5252import { DeletedNodesPaging , Node , NodeEntry , PathInfo , SiteBodyCreate , SiteEntry } from '@alfresco/js-api' ;
5353import { inject , Injectable } from '@angular/core' ;
5454import { MatDialog , MatDialogConfig } from '@angular/material/dialog' ;
5555import { Store } from '@ngrx/store' ;
5656import { forkJoin , Observable , of , zip } from 'rxjs' ;
5757import { catchError , map , mergeMap , take , tap } from 'rxjs/operators' ;
5858import { NodeActionsService } from './node-actions.service' ;
59- import { Router } from '@angular/router' ;
59+ import { ActivatedRoute , Router } from '@angular/router' ;
6060import { FolderInformationComponent } from '../dialogs/folder-details/folder-information.component' ;
6161
6262interface RestoredNode {
@@ -76,25 +76,23 @@ interface SnackbarMessageData {
7676 providedIn : 'root'
7777} )
7878export class ContentManagementService {
79- private notificationService = inject ( NotificationService ) ;
79+ private readonly notificationService = inject ( NotificationService ) ;
80+ private readonly nodesApiService = inject ( NodesApiService ) ;
81+ private readonly store = inject ( Store < AppStore > ) ;
82+ private readonly contentApi = inject ( ContentApiService ) ;
83+ private readonly permission = inject ( NodePermissionService ) ;
84+ private readonly dialogRef = inject ( MatDialog ) ;
85+ private readonly nodeActionsService = inject ( NodeActionsService ) ;
86+ private readonly translation = inject ( TranslationService ) ;
87+ private readonly nodeAspectService = inject ( NodeAspectService ) ;
88+ private readonly activatedRoute = inject ( ActivatedRoute ) ;
89+ private readonly appHookService = inject ( AppHookService ) ;
90+ private readonly newVersionUploaderService = inject ( NewVersionUploaderService ) ;
91+ private readonly router = inject ( Router ) ;
92+ private readonly appSettingsService = inject ( AppSettingsService ) ;
93+ private readonly documentListService = inject ( DocumentListService ) ;
8094 private readonly createMenuButtonSelector = 'app-toolbar-menu button[id="app.toolbar.create"]' ;
8195
82- constructor (
83- private nodesApiService : NodesApiService ,
84- private store : Store < AppStore > ,
85- private contentApi : ContentApiService ,
86- private permission : NodePermissionService ,
87- private dialogRef : MatDialog ,
88- private nodeActionsService : NodeActionsService ,
89- private translation : TranslationService ,
90- private nodeAspectService : NodeAspectService ,
91- private appHookService : AppHookService ,
92- private newVersionUploaderService : NewVersionUploaderService ,
93- private router : Router ,
94- private appSettingsService : AppSettingsService ,
95- private documentListService : DocumentListService
96- ) { }
97-
9896 addFavorite ( nodes : Array < NodeEntry > ) {
9997 if ( nodes && nodes . length > 0 ) {
10098 this . contentApi . addFavorite ( nodes ) . subscribe ( ( ) => {
@@ -618,13 +616,11 @@ export class ContentManagementService {
618616 this . documentListService . reload ( ) ;
619617 this . store . dispatch ( new RefreshPreviewAction ( newVersionUploaderData . node ) ) ;
620618 break ;
621- case NewVersionUploaderDataAction . view :
622- this . store . dispatch (
623- new ViewNodeVersionAction ( node . id , newVersionUploaderData . versionId , {
624- location : this . router . url
625- } )
626- ) ;
619+ case NewVersionUploaderDataAction . view : {
620+ const location = this . activatedRoute . snapshot . queryParams [ 'location' ] || this . router . url ;
621+ this . store . dispatch ( new ViewNodeVersionAction ( node . id , newVersionUploaderData . versionId , { location } ) ) ;
627622 break ;
623+ }
628624 default :
629625 break ;
630626 }
0 commit comments