Skip to content

Commit

Permalink
Fix NSFW blur on search
Browse files Browse the repository at this point in the history
  • Loading branch information
Chocobozzz committed Jan 14, 2019
1 parent c32bf83 commit 033bc0e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion client/src/app/search/search.component.html
Expand Up @@ -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>
Expand Down
9 changes: 7 additions & 2 deletions client/src/app/search/search.component.ts
@@ -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'
Expand Down Expand Up @@ -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 () {
Expand Down Expand Up @@ -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
}
Expand Down

0 comments on commit 033bc0e

Please sign in to comment.