Fix lint & tests
authorChocobozzz <me@florianbigard.com>
Wed, 18 Dec 2019 15:38:39 +0000 (16:38 +0100)
committerChocobozzz <me@florianbigard.com>
Wed, 18 Dec 2019 15:47:54 +0000 (16:47 +0100)
client/src/app/videos/+video-watch/video-watch.component.ts
server/models/account/user.ts

index 626d0ca07e115b3ac8bcdefb70cd633fc07d038a..835e9e34a9cc6d5f9168f087d74e47a4c4ac3b05 100644 (file)
@@ -147,7 +147,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
 
     this.queryParamsSub = this.route.queryParams.subscribe(async queryParams => {
       const videoId = queryParams[ 'videoId' ]
-      if (videoId) await this.loadVideo(videoId)
+      if (videoId) this.loadVideo(videoId)
 
       const start = queryParams[ 'start' ]
       if (this.player && start) this.player.currentTime(parseInt(start, 10))
index b2cd25bc32f2ab99abaa11edb1117dcfea36a52a..3a339b5c35512506f0f1fa8dc0fe6f409e22274c 100644 (file)
@@ -583,16 +583,18 @@ export class UserModel extends Model<UserModel> {
   }
 
   canGetVideo (video: MVideoFullLight) {
-    if (video.privacy === VideoPrivacy.INTERNAL) return true
+    const videoUserId = video.VideoChannel.Account.userId
 
-    if (video.privacy === VideoPrivacy.PRIVATE) {
-      return video.VideoChannel && video.VideoChannel.Account.userId === this.id
+    if (video.isBlacklisted()) {
+      return videoUserId === this.id || this.hasRight(UserRight.MANAGE_VIDEO_BLACKLIST)
     }
 
-    if (video.isBlacklisted()) {
-      return this.hasRight(UserRight.MANAGE_VIDEO_BLACKLIST)
+    if (video.privacy === VideoPrivacy.PRIVATE) {
+      return video.VideoChannel && videoUserId === this.id || this.hasRight(UserRight.MANAGE_VIDEO_BLACKLIST)
     }
 
+    if (video.privacy === VideoPrivacy.INTERNAL) return true
+
     return false
   }