diff options
author | Chocobozzz <me@florianbigard.com> | 2020-06-16 11:00:35 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2020-06-16 11:26:46 +0200 |
commit | 5c20a45518c3afc40c9494cad4a78def92e5e288 (patch) | |
tree | d4f6894b37394f3a40e6c58d34012bc55c05f55e /client/src/app/search | |
parent | 64e0f8cf12c804a7a2fa582fd954f686cea9a45b (diff) | |
download | PeerTube-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.html | 2 | ||||
-rw-r--r-- | client/src/app/search/search.component.ts | 13 |
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' | |||
5 | import { HooksService } from '@app/core/plugins/hooks.service' | 5 | import { HooksService } from '@app/core/plugins/hooks.service' |
6 | import { AdvancedSearch } from '@app/search/advanced-search.model' | 6 | import { AdvancedSearch } from '@app/search/advanced-search.model' |
7 | import { SearchService } from '@app/search/search.service' | 7 | import { SearchService } from '@app/search/search.service' |
8 | import { UserService } from '@app/shared' | ||
8 | import { immutableAssign } from '@app/shared/misc/utils' | 9 | import { immutableAssign } from '@app/shared/misc/utils' |
9 | import { ComponentPagination } from '@app/shared/rest/component-pagination.model' | 10 | import { ComponentPagination } from '@app/shared/rest/component-pagination.model' |
10 | import { VideoChannel } from '@app/shared/video-channel/video-channel.model' | 11 | import { VideoChannel } from '@app/shared/video-channel/video-channel.model' |
@@ -12,7 +13,7 @@ import { MiniatureDisplayOptions } from '@app/shared/video/video-miniature.compo | |||
12 | import { Video } from '@app/shared/video/video.model' | 13 | import { Video } from '@app/shared/video/video.model' |
13 | import { MetaService } from '@ngx-meta/core' | 14 | import { MetaService } from '@ngx-meta/core' |
14 | import { I18n } from '@ngx-translate/i18n-polyfill' | 15 | import { I18n } from '@ngx-translate/i18n-polyfill' |
15 | import { ServerConfig } from '@shared/models' | 16 | import { ServerConfig, User } from '@shared/models' |
16 | import { SearchTargetType } from '@shared/models/search/search-target-query.model' | 17 | import { 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 | ||