Don't send view on private video
authorChocobozzz <me@florianbigard.com>
Mon, 18 Jun 2018 07:42:16 +0000 (09:42 +0200)
committerChocobozzz <me@florianbigard.com>
Mon, 18 Jun 2018 08:26:18 +0000 (10:26 +0200)
client/src/app/videos/+video-edit/shared/video-edit.component.ts
client/src/app/videos/+video-watch/video-watch.component.ts
client/src/assets/player/peertube-videojs-plugin.ts

index 24418fc4f2a12e1a56682a6eaccbefaccad91802..66eb6611a78096869805da41574ba0748a335953 100644 (file)
@@ -35,7 +35,6 @@ export class VideoEditComponent implements OnInit {
 
   schedulePublicationEnabled = false
 
-  error: string = null
   calendarLocale: any = {}
   minScheduledDate = new Date()
 
index 72e96ca93862fe92a3b49eec65b5da47a86c6aad..6f6bd4e5d55528b7048317846fd2de57bfd0b977 100644 (file)
@@ -10,7 +10,7 @@ import { Subscription } from 'rxjs'
 import * as videojs from 'video.js'
 import 'videojs-hotkeys'
 import * as WebTorrent from 'webtorrent'
-import { UserVideoRateType, VideoRateType, VideoState } from '../../../../../shared'
+import { UserVideoRateType, VideoPrivacy, VideoRateType, VideoState } from '../../../../../shared'
 import '../../../assets/player/peertube-videojs-plugin'
 import { AuthService, ConfirmService } from '../../core'
 import { RestExtractor, VideoBlacklistService } from '../../shared'
@@ -368,7 +368,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
       inactivityTimeout: 2500,
       videoFiles: this.video.files,
       playerElement: this.playerElement,
-      videoViewUrl: this.videoService.getVideoViewUrl(this.video.uuid),
+      videoViewUrl: this.video.privacy.id !== VideoPrivacy.PRIVATE ? this.videoService.getVideoViewUrl(this.video.uuid) : null,
       videoDuration: this.video.duration,
       enableHotkeys: true,
       peertubeLink: false,
index fe9fc1a696ffad27cdbe20e10aed5c4842ad93b4..b62dcb8299ed2364f77072fb01a614d1450693df 100644 (file)
@@ -502,6 +502,8 @@ class PeerTubePlugin extends Plugin {
   }
 
   private addViewToVideo () {
+    if (!this.videoViewUrl) return Promise.resolve(undefined)
+
     return fetch(this.videoViewUrl, { method: 'POST' })
   }