]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - client/src/app/+my-account/my-account-videos/my-account-videos.component.ts
Better typings
[github/Chocobozzz/PeerTube.git] / client / src / app / +my-account / my-account-videos / my-account-videos.component.ts
index 01e1ef1da28780877338322926d55f217c77d406..2d88ac760bc6254fb9e3a08d3432a4f23f7896d4 100644 (file)
@@ -1,6 +1,6 @@
 import { from as observableFrom, Observable } from 'rxjs'
 import { concatAll, tap } from 'rxjs/operators'
-import { Component, OnDestroy, OnInit, Inject, LOCALE_ID } from '@angular/core'
+import { Component, OnDestroy, OnInit, Inject, LOCALE_ID, ViewChild } from '@angular/core'
 import { ActivatedRoute, Router } from '@angular/router'
 import { Location } from '@angular/common'
 import { immutableAssign } from '@app/shared/misc/utils'
@@ -14,6 +14,7 @@ import { VideoService } from '../../shared/video/video.service'
 import { I18n } from '@ngx-translate/i18n-polyfill'
 import { VideoPrivacy, VideoState } from '../../../../../shared/models/videos'
 import { ScreenService } from '@app/shared/misc/screen.service'
+import { VideoChangeOwnershipComponent } from './video-change-ownership/video-change-ownership.component'
 
 @Component({
   selector: 'my-account-videos',
@@ -33,6 +34,8 @@ export class MyAccountVideosComponent extends AbstractVideoList implements OnIni
   protected baseVideoWidth = -1
   protected baseVideoHeight = 155
 
+  @ViewChild('videoChangeOwnershipModal') videoChangeOwnershipModal: VideoChangeOwnershipComponent
+
   constructor (
     protected router: Router,
     protected route: ActivatedRoute,
@@ -133,6 +136,11 @@ export class MyAccountVideosComponent extends AbstractVideoList implements OnIni
         )
   }
 
+  changeOwnership (event: Event, video: Video) {
+    event.preventDefault()
+    this.videoChangeOwnershipModal.show(video)
+  }
+
   getStateLabel (video: Video) {
     let suffix: string
 
@@ -161,7 +169,7 @@ export class MyAccountVideosComponent extends AbstractVideoList implements OnIni
 
   private spliceVideosById (id: number) {
     for (const key of Object.keys(this.loadedPages)) {
-      const videos = this.loadedPages[ key ]
+      const videos: Video[] = this.loadedPages[ key ]
       const index = videos.findIndex(v => v.id === id)
 
       if (index !== -1) {