]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/commitdiff
Fix NSFW blur on search
authorChocobozzz <me@florianbigard.com>
Fri, 11 Jan 2019 15:58:33 +0000 (16:58 +0100)
committerChocobozzz <me@florianbigard.com>
Mon, 14 Jan 2019 08:07:08 +0000 (09:07 +0100)
client/src/app/search/search.component.html
client/src/app/search/search.component.ts

index 3a87ea1dee5bccef0c5a258f0d3ad2ef1bd690d8..82a5f0f26bbd62e779c58ca278512b70f17d0a2d 100644 (file)
@@ -48,7 +48,7 @@
     </div>
 
     <div *ngIf="isVideo(result)" class="entry video">
-      <my-video-thumbnail [video]="result"></my-video-thumbnail>
+      <my-video-thumbnail [video]="result" [nsfw]="isVideoBlur(result)"></my-video-thumbnail>
 
       <div class="video-info">
         <a tabindex="-1" class="video-info-name" [routerLink]="['/videos/watch', result.uuid]" [attr.title]="result.name">{{ result.name }}</a>
index 474b728244867b58c6dfacac9e128cb087d060ad..c4a4b1fdebf7a472916c81bc22f1c86e10e8cd27 100644 (file)
@@ -1,6 +1,6 @@
 import { Component, OnDestroy, OnInit } from '@angular/core'
 import { ActivatedRoute, Router } from '@angular/router'
-import { AuthService, Notifier } from '@app/core'
+import { AuthService, Notifier, ServerService } from '@app/core'
 import { forkJoin, Subscription } from 'rxjs'
 import { SearchService } from '@app/search/search.service'
 import { ComponentPagination } from '@app/shared/rest/component-pagination.model'
@@ -41,7 +41,8 @@ export class SearchComponent implements OnInit, OnDestroy {
     private metaService: MetaService,
     private notifier: Notifier,
     private searchService: SearchService,
-    private authService: AuthService
+    private authService: AuthService,
+    private serverService: ServerService
   ) { }
 
   ngOnInit () {
@@ -75,6 +76,10 @@ export class SearchComponent implements OnInit, OnDestroy {
     if (this.subActivatedRoute) this.subActivatedRoute.unsubscribe()
   }
 
+  isVideoBlur (video: Video) {
+    return video.isVideoNSFWForUser(this.authService.getUser(), this.serverService.getConfig())
+  }
+
   isVideoChannel (d: VideoChannel | Video): d is VideoChannel {
     return d instanceof VideoChannel
   }