]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - client/src/app/shared/video/video-miniature.component.ts
Fix videos list user NSFW policy
[github/Chocobozzz/PeerTube.git] / client / src / app / shared / video / video-miniature.component.ts
index 07193ebd580d1cd5f02bd391a7c870faf1d9de4b..7e8692b0be9f93b4bcb819ba431998e8a822cede 100644 (file)
@@ -1,4 +1,4 @@
-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'
@@ -8,7 +8,8 @@ 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 +20,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 +42,6 @@ export class VideoMiniatureComponent implements OnInit {
     }
   }
 
-  isVideoBlur () {
-    return this.video.isVideoNSFWForUser(this.user, this.serverService.getConfig())
-  }
-
   displayOwnerAccount () {
     return this.ownerDisplayTypeChosen === 'account'
   }