diff options
Diffstat (limited to 'client/src/app/search/search.component.ts')
-rw-r--r-- | client/src/app/search/search.component.ts | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/client/src/app/search/search.component.ts b/client/src/app/search/search.component.ts index c4a4b1fde..a7ddbe1f8 100644 --- a/client/src/app/search/search.component.ts +++ b/client/src/app/search/search.component.ts | |||
@@ -1,6 +1,6 @@ | |||
1 | import { Component, OnDestroy, OnInit } from '@angular/core' | 1 | import { Component, OnDestroy, OnInit } from '@angular/core' |
2 | import { ActivatedRoute, Router } from '@angular/router' | 2 | import { ActivatedRoute, Router } from '@angular/router' |
3 | import { AuthService, Notifier, ServerService } from '@app/core' | 3 | import { AuthService, Notifier } from '@app/core' |
4 | import { forkJoin, Subscription } from 'rxjs' | 4 | import { forkJoin, Subscription } from 'rxjs' |
5 | import { SearchService } from '@app/search/search.service' | 5 | import { SearchService } from '@app/search/search.service' |
6 | import { ComponentPagination } from '@app/shared/rest/component-pagination.model' | 6 | import { ComponentPagination } from '@app/shared/rest/component-pagination.model' |
@@ -41,10 +41,13 @@ export class SearchComponent implements OnInit, OnDestroy { | |||
41 | private metaService: MetaService, | 41 | private metaService: MetaService, |
42 | private notifier: Notifier, | 42 | private notifier: Notifier, |
43 | private searchService: SearchService, | 43 | private searchService: SearchService, |
44 | private authService: AuthService, | 44 | private authService: AuthService |
45 | private serverService: ServerService | ||
46 | ) { } | 45 | ) { } |
47 | 46 | ||
47 | get user () { | ||
48 | return this.authService.getUser() | ||
49 | } | ||
50 | |||
48 | ngOnInit () { | 51 | ngOnInit () { |
49 | this.subActivatedRoute = this.route.queryParams.subscribe( | 52 | this.subActivatedRoute = this.route.queryParams.subscribe( |
50 | queryParams => { | 53 | queryParams => { |
@@ -76,10 +79,6 @@ export class SearchComponent implements OnInit, OnDestroy { | |||
76 | if (this.subActivatedRoute) this.subActivatedRoute.unsubscribe() | 79 | if (this.subActivatedRoute) this.subActivatedRoute.unsubscribe() |
77 | } | 80 | } |
78 | 81 | ||
79 | isVideoBlur (video: Video) { | ||
80 | return video.isVideoNSFWForUser(this.authService.getUser(), this.serverService.getConfig()) | ||
81 | } | ||
82 | |||
83 | isVideoChannel (d: VideoChannel | Video): d is VideoChannel { | 82 | isVideoChannel (d: VideoChannel | Video): d is VideoChannel { |
84 | return d instanceof VideoChannel | 83 | return d instanceof VideoChannel |
85 | } | 84 | } |
@@ -139,6 +138,10 @@ export class SearchComponent implements OnInit, OnDestroy { | |||
139 | return this.advancedSearch.size() | 138 | return this.advancedSearch.size() |
140 | } | 139 | } |
141 | 140 | ||
141 | removeVideoFromArray (video: Video) { | ||
142 | this.results = this.results.filter(r => !this.isVideo(r) || r.id !== video.id) | ||
143 | } | ||
144 | |||
142 | private resetPagination () { | 145 | private resetPagination () { |
143 | this.pagination.currentPage = 1 | 146 | this.pagination.currentPage = 1 |
144 | this.pagination.totalItems = null | 147 | this.pagination.totalItems = null |