From 5c20a45518c3afc40c9494cad4a78def92e5e288 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 16 Jun 2020 11:00:35 +0200 Subject: Fix anonymous nsfw policy --- client/src/app/search/search.component.ts | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'client/src/app/search/search.component.ts') diff --git a/client/src/app/search/search.component.ts b/client/src/app/search/search.component.ts index eea015c2e..bed5de79e 100644 --- a/client/src/app/search/search.component.ts +++ b/client/src/app/search/search.component.ts @@ -5,6 +5,7 @@ import { AuthService, Notifier, ServerService } from '@app/core' import { HooksService } from '@app/core/plugins/hooks.service' import { AdvancedSearch } from '@app/search/advanced-search.model' import { SearchService } from '@app/search/search.service' +import { UserService } from '@app/shared' import { immutableAssign } from '@app/shared/misc/utils' import { ComponentPagination } from '@app/shared/rest/component-pagination.model' import { VideoChannel } from '@app/shared/video-channel/video-channel.model' @@ -12,7 +13,7 @@ import { MiniatureDisplayOptions } from '@app/shared/video/video-miniature.compo import { Video } from '@app/shared/video/video.model' import { MetaService } from '@ngx-meta/core' import { I18n } from '@ngx-translate/i18n-polyfill' -import { ServerConfig } from '@shared/models' +import { ServerConfig, User } from '@shared/models' import { SearchTargetType } from '@shared/models/search/search-target-query.model' @Component({ @@ -46,6 +47,8 @@ export class SearchComponent implements OnInit, OnDestroy { errorMessage: string serverConfig: ServerConfig + userMiniature: User + private subActivatedRoute: Subscription private isInitialLoad = false // set to false to show the search filters on first arrival private firstSearch = true @@ -62,14 +65,11 @@ export class SearchComponent implements OnInit, OnDestroy { private notifier: Notifier, private searchService: SearchService, private authService: AuthService, + private userService: UserService, private hooks: HooksService, private serverService: ServerService ) { } - get user () { - return this.authService.getUser() - } - ngOnInit () { this.serverService.getConfig() .subscribe(config => this.serverConfig = config) @@ -103,6 +103,9 @@ export class SearchComponent implements OnInit, OnDestroy { err => this.notifier.error(err.text) ) + this.userService.getAnonymousOrLoggedUser() + .subscribe(user => this.userMiniature = user) + this.hooks.runAction('action:search.init', 'search') } -- cgit v1.2.3