aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/search
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2020-06-16 11:00:35 +0200
committerChocobozzz <me@florianbigard.com>2020-06-16 11:26:46 +0200
commit5c20a45518c3afc40c9494cad4a78def92e5e288 (patch)
treed4f6894b37394f3a40e6c58d34012bc55c05f55e /client/src/app/search
parent64e0f8cf12c804a7a2fa582fd954f686cea9a45b (diff)
downloadPeerTube-5c20a45518c3afc40c9494cad4a78def92e5e288.tar.gz
PeerTube-5c20a45518c3afc40c9494cad4a78def92e5e288.tar.zst
PeerTube-5c20a45518c3afc40c9494cad4a78def92e5e288.zip
Fix anonymous nsfw policy
Diffstat (limited to 'client/src/app/search')
-rw-r--r--client/src/app/search/search.component.html2
-rw-r--r--client/src/app/search/search.component.ts13
2 files changed, 9 insertions, 6 deletions
diff --git a/client/src/app/search/search.component.html b/client/src/app/search/search.component.html
index 6acdedf92..9bff024ad 100644
--- a/client/src/app/search/search.component.html
+++ b/client/src/app/search/search.component.html
@@ -53,7 +53,7 @@
53 53
54 <div *ngIf="isVideo(result)" class="entry video"> 54 <div *ngIf="isVideo(result)" class="entry video">
55 <my-video-miniature 55 <my-video-miniature
56 [video]="result" [user]="user" [displayAsRow]="true" [displayVideoActions]="!hideActions()" 56 [video]="result" [user]="userMiniature" [displayAsRow]="true" [displayVideoActions]="!hideActions()"
57 [displayOptions]="videoDisplayOptions" [useLazyLoadUrl]="advancedSearch.searchTarget === 'search-index'" 57 [displayOptions]="videoDisplayOptions" [useLazyLoadUrl]="advancedSearch.searchTarget === 'search-index'"
58 (videoBlocked)="removeVideoFromArray(result)" (videoRemoved)="removeVideoFromArray(result)" 58 (videoBlocked)="removeVideoFromArray(result)" (videoRemoved)="removeVideoFromArray(result)"
59 ></my-video-miniature> 59 ></my-video-miniature>
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'
5import { HooksService } from '@app/core/plugins/hooks.service' 5import { HooksService } from '@app/core/plugins/hooks.service'
6import { AdvancedSearch } from '@app/search/advanced-search.model' 6import { AdvancedSearch } from '@app/search/advanced-search.model'
7import { SearchService } from '@app/search/search.service' 7import { SearchService } from '@app/search/search.service'
8import { UserService } from '@app/shared'
8import { immutableAssign } from '@app/shared/misc/utils' 9import { immutableAssign } from '@app/shared/misc/utils'
9import { ComponentPagination } from '@app/shared/rest/component-pagination.model' 10import { ComponentPagination } from '@app/shared/rest/component-pagination.model'
10import { VideoChannel } from '@app/shared/video-channel/video-channel.model' 11import { VideoChannel } from '@app/shared/video-channel/video-channel.model'
@@ -12,7 +13,7 @@ import { MiniatureDisplayOptions } from '@app/shared/video/video-miniature.compo
12import { Video } from '@app/shared/video/video.model' 13import { Video } from '@app/shared/video/video.model'
13import { MetaService } from '@ngx-meta/core' 14import { MetaService } from '@ngx-meta/core'
14import { I18n } from '@ngx-translate/i18n-polyfill' 15import { I18n } from '@ngx-translate/i18n-polyfill'
15import { ServerConfig } from '@shared/models' 16import { ServerConfig, User } from '@shared/models'
16import { SearchTargetType } from '@shared/models/search/search-target-query.model' 17import { SearchTargetType } from '@shared/models/search/search-target-query.model'
17 18
18@Component({ 19@Component({
@@ -46,6 +47,8 @@ export class SearchComponent implements OnInit, OnDestroy {
46 errorMessage: string 47 errorMessage: string
47 serverConfig: ServerConfig 48 serverConfig: ServerConfig
48 49
50 userMiniature: User
51
49 private subActivatedRoute: Subscription 52 private subActivatedRoute: Subscription
50 private isInitialLoad = false // set to false to show the search filters on first arrival 53 private isInitialLoad = false // set to false to show the search filters on first arrival
51 private firstSearch = true 54 private firstSearch = true
@@ -62,14 +65,11 @@ export class SearchComponent implements OnInit, OnDestroy {
62 private notifier: Notifier, 65 private notifier: Notifier,
63 private searchService: SearchService, 66 private searchService: SearchService,
64 private authService: AuthService, 67 private authService: AuthService,
68 private userService: UserService,
65 private hooks: HooksService, 69 private hooks: HooksService,
66 private serverService: ServerService 70 private serverService: ServerService
67 ) { } 71 ) { }
68 72
69 get user () {
70 return this.authService.getUser()
71 }
72
73 ngOnInit () { 73 ngOnInit () {
74 this.serverService.getConfig() 74 this.serverService.getConfig()
75 .subscribe(config => this.serverConfig = config) 75 .subscribe(config => this.serverConfig = config)
@@ -103,6 +103,9 @@ export class SearchComponent implements OnInit, OnDestroy {
103 err => this.notifier.error(err.text) 103 err => this.notifier.error(err.text)
104 ) 104 )
105 105
106 this.userService.getAnonymousOrLoggedUser()
107 .subscribe(user => this.userMiniature = user)
108
106 this.hooks.runAction('action:search.init', 'search') 109 this.hooks.runAction('action:search.init', 'search')
107 } 110 }
108 111