Fix NSFW blur on search

This commit is contained in:
Chocobozzz 2019-01-11 16:58:33 +01:00
parent c32bf839c1
commit 033bc0efc2
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
2 changed files with 8 additions and 3 deletions

View File

@ -48,7 +48,7 @@
</div> </div>
<div *ngIf="isVideo(result)" class="entry video"> <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"> <div class="video-info">
<a tabindex="-1" class="video-info-name" [routerLink]="['/videos/watch', result.uuid]" [attr.title]="result.name">{{ result.name }}</a> <a tabindex="-1" class="video-info-name" [routerLink]="['/videos/watch', result.uuid]" [attr.title]="result.name">{{ result.name }}</a>

View File

@ -1,6 +1,6 @@
import { Component, OnDestroy, OnInit } from '@angular/core' import { Component, OnDestroy, OnInit } from '@angular/core'
import { ActivatedRoute, Router } from '@angular/router' 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 { forkJoin, Subscription } from 'rxjs'
import { SearchService } from '@app/search/search.service' import { SearchService } from '@app/search/search.service'
import { ComponentPagination } from '@app/shared/rest/component-pagination.model' import { ComponentPagination } from '@app/shared/rest/component-pagination.model'
@ -41,7 +41,8 @@ export class SearchComponent implements OnInit, OnDestroy {
private metaService: MetaService, private metaService: MetaService,
private notifier: Notifier, private notifier: Notifier,
private searchService: SearchService, private searchService: SearchService,
private authService: AuthService private authService: AuthService,
private serverService: ServerService
) { } ) { }
ngOnInit () { ngOnInit () {
@ -75,6 +76,10 @@ export class SearchComponent implements OnInit, OnDestroy {
if (this.subActivatedRoute) this.subActivatedRoute.unsubscribe() 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 { isVideoChannel (d: VideoChannel | Video): d is VideoChannel {
return d instanceof VideoChannel return d instanceof VideoChannel
} }