]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - client/src/app/+videos/+video-edit/video-update.resolver.ts
Sort channels by -updatedAt
[github/Chocobozzz/PeerTube.git] / client / src / app / +videos / +video-edit / video-update.resolver.ts
index 276548b797a18cd202d6c7673e7d6520e30652b6..9172b78a88154a890b5711bb7de6cc0a4baf4b2f 100644 (file)
@@ -2,7 +2,9 @@ import { forkJoin, of } from 'rxjs'
 import { map, switchMap } from 'rxjs/operators'
 import { Injectable } from '@angular/core'
 import { ActivatedRouteSnapshot, Resolve } from '@angular/router'
-import { VideoCaptionService, VideoChannelService, VideoDetails, VideoService } from '@app/shared/shared-main'
+import { AuthService } from '@app/core'
+import { listUserChannels } from '@app/helpers'
+import { VideoCaptionService, VideoDetails, VideoService } from '@app/shared/shared-main'
 import { LiveVideoService } from '@app/shared/shared-video-live'
 
 @Injectable()
@@ -10,7 +12,7 @@ export class VideoUpdateResolver implements Resolve<any> {
   constructor (
     private videoService: VideoService,
     private liveVideoService: LiveVideoService,
-    private videoChannelService: VideoChannelService,
+    private authService: AuthService,
     private videoCaptionService: VideoCaptionService
   ) {
   }
@@ -31,17 +33,7 @@ export class VideoUpdateResolver implements Resolve<any> {
         .loadCompleteDescription(video.descriptionPath)
         .pipe(map(description => Object.assign(video, { description }))),
 
-      this.videoChannelService
-        .listAccountVideoChannels(video.account)
-        .pipe(
-          map(result => result.data),
-          map(videoChannels => videoChannels.map(c => ({
-            id: c.id,
-            label: c.displayName,
-            support: c.support,
-            avatarPath: c.avatar?.path
-          })))
-        ),
+      listUserChannels(this.authService),
 
       this.videoCaptionService
         .listCaptions(video.id)