]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/models/account/user.ts
Fix lint & tests
[github/Chocobozzz/PeerTube.git] / server / models / account / user.ts
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
   }