]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - client/src/app/videos/+video-watch/video-watch.component.ts
Fix contributing guide concerning unit tests
[github/Chocobozzz/PeerTube.git] / client / src / app / videos / +video-watch / video-watch.component.ts
index df5b8d02d6f18c8a3c01fdd8fabe4abd0942985d..6f6f02378ca577b2ebfb48d2fe80533de72051b1 100644 (file)
@@ -22,6 +22,7 @@ import { VideoDownloadComponent } from './modal/video-download.component'
 import { VideoReportComponent } from './modal/video-report.component'
 import { VideoShareComponent } from './modal/video-share.component'
 import { getVideojsOptions } from '../../../assets/player/peertube-player'
+import { ServerService } from '@app/core'
 
 @Component({
   selector: 'my-video-watch',
@@ -38,6 +39,8 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
 
   otherVideosDisplayed: Video[] = []
 
+  syndicationItems = {}
+
   player: videojs.Player
   playerElement: HTMLVideoElement
   userRating: UserVideoRateType = null
@@ -64,6 +67,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
     private confirmService: ConfirmService,
     private metaService: MetaService,
     private authService: AuthService,
+    private serverService: ServerService,
     private notificationsService: NotificationsService,
     private markdownService: MarkdownService,
     private zone: NgZone,
@@ -98,14 +102,15 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
       }
 
       const uuid = routeParams['uuid']
-      // Video did not changed
+      // Video did not change
       if (this.video && this.video.uuid === uuid) return
-
+      // Video did change
       this.videoService.getVideo(uuid).subscribe(
         video => {
           const startTime = this.route.snapshot.queryParams.start
           this.onVideoFetched(video, startTime)
             .catch(err => this.handleError(err))
+          this.generateSyndicationList()
         },
 
         error => {
@@ -242,6 +247,10 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
     return this.video.tags.join(', ')
   }
 
+  generateSyndicationList () {
+    this.syndicationItems = this.videoService.getAccountFeedUrls(this.video.account.id)
+  }
+
   isVideoRemovable () {
     return this.video.isRemovableBy(this.authService.getUser())
   }
@@ -328,7 +337,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
 
     this.updateOtherVideosDisplayed()
 
-    if (this.video.isVideoNSFWForUser(this.user)) {
+    if (this.video.isVideoNSFWForUser(this.user, this.serverService.getConfig())) {
       const res = await this.confirmService.confirm(
         'This video contains mature or explicit content. Are you sure you want to watch it?',
         'Mature or explicit content'