]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - client/src/app/shared/video/video-miniature.component.ts
Add ability to list all local videos on client
[github/Chocobozzz/PeerTube.git] / client / src / app / shared / video / video-miniature.component.ts
index 27098f4b4a0c097c5987572328d7b8dab1e5d7bb..2f951a1f1b3ecb25eeb7d1d84901b31922b9f4fc 100644 (file)
@@ -2,6 +2,7 @@ import { ChangeDetectionStrategy, Component, Input, OnInit } from '@angular/core
 import { User } from '../users'
 import { Video } from './video.model'
 import { ServerService } from '@app/core'
+import { VideoPrivacy } from '../../../../../shared'
 
 export type OwnerDisplayType = 'account' | 'videoChannel' | 'auto'
 
@@ -16,12 +17,14 @@ export class VideoMiniatureComponent implements OnInit {
   @Input() video: Video
   @Input() ownerDisplayType: OwnerDisplayType = 'account'
 
-  isVideoBlur: boolean
-
   private ownerDisplayTypeChosen: 'account' | 'videoChannel'
 
   constructor (private serverService: ServerService) { }
 
+  get isVideoBlur () {
+    return this.video.isVideoNSFWForUser(this.user, this.serverService.getConfig())
+  }
+
   ngOnInit () {
     if (this.ownerDisplayType === 'account' || this.ownerDisplayType === 'videoChannel') {
       this.ownerDisplayTypeChosen = this.ownerDisplayType
@@ -38,8 +41,6 @@ export class VideoMiniatureComponent implements OnInit {
     } else {
       this.ownerDisplayTypeChosen = 'videoChannel'
     }
-
-    this.isVideoBlur = this.video.isVideoNSFWForUser(this.user, this.serverService.getConfig())
   }
 
   displayOwnerAccount () {
@@ -49,4 +50,12 @@ export class VideoMiniatureComponent implements OnInit {
   displayOwnerVideoChannel () {
     return this.ownerDisplayTypeChosen === 'videoChannel'
   }
+
+  isUnlistedVideo () {
+    return this.video.privacy.id === VideoPrivacy.UNLISTED
+  }
+
+  isPrivateVideo () {
+    return this.video.privacy.id === VideoPrivacy.PRIVATE
+  }
 }