]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - client/src/app/shared/video/video-miniature.component.ts
Refactor ellipsis CSS
[github/Chocobozzz/PeerTube.git] / client / src / app / shared / video / video-miniature.component.ts
index 07193ebd580d1cd5f02bd391a7c870faf1d9de4b..2f951a1f1b3ecb25eeb7d1d84901b31922b9f4fc 100644 (file)
@@ -1,14 +1,16 @@
-import { Component, Input, OnInit } from '@angular/core'
+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'
 
 @Component({
   selector: 'my-video-miniature',
   styleUrls: [ './video-miniature.component.scss' ],
-  templateUrl: './video-miniature.component.html'
+  templateUrl: './video-miniature.component.html',
+  changeDetection: ChangeDetectionStrategy.OnPush
 })
 export class VideoMiniatureComponent implements OnInit {
   @Input() user: User
@@ -19,6 +21,10 @@ export class VideoMiniatureComponent implements OnInit {
 
   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
@@ -37,10 +43,6 @@ export class VideoMiniatureComponent implements OnInit {
     }
   }
 
-  isVideoBlur () {
-    return this.video.isVideoNSFWForUser(this.user, this.serverService.getConfig())
-  }
-
   displayOwnerAccount () {
     return this.ownerDisplayTypeChosen === 'account'
   }
@@ -48,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
+  }
 }