aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/videos/recommendations/recommended-videos.component.ts
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/videos/recommendations/recommended-videos.component.ts
parent64e0f8cf12c804a7a2fa582fd954f686cea9a45b (diff)
downloadPeerTube-5c20a45518c3afc40c9494cad4a78def92e5e288.tar.gz
PeerTube-5c20a45518c3afc40c9494cad4a78def92e5e288.tar.zst
PeerTube-5c20a45518c3afc40c9494cad4a78def92e5e288.zip
Fix anonymous nsfw policy
Diffstat (limited to 'client/src/app/videos/recommendations/recommended-videos.component.ts')
-rw-r--r--client/src/app/videos/recommendations/recommended-videos.component.ts26
1 files changed, 16 insertions, 10 deletions
diff --git a/client/src/app/videos/recommendations/recommended-videos.component.ts b/client/src/app/videos/recommendations/recommended-videos.component.ts
index d4a5df19a..a6f3bce3d 100644
--- a/client/src/app/videos/recommendations/recommended-videos.component.ts
+++ b/client/src/app/videos/recommendations/recommended-videos.component.ts
@@ -1,24 +1,23 @@
1import { Component, Input, Output, OnChanges, EventEmitter } from '@angular/core'
2import { Observable } from 'rxjs' 1import { Observable } from 'rxjs'
3import { Video } from '@app/shared/video/video.model' 2import { Component, EventEmitter, Input, OnChanges, OnInit, Output } from '@angular/core'
3import { AuthService, Notifier } from '@app/core'
4import { User } from '@app/shared'
5import { SessionStorageService } from '@app/shared/misc/storage.service'
6import { UserService } from '@app/shared/users/user.service'
4import { VideoPlaylist } from '@app/shared/video-playlist/video-playlist.model' 7import { VideoPlaylist } from '@app/shared/video-playlist/video-playlist.model'
5import { RecommendationInfo } from '@app/shared/video/recommendation-info.model' 8import { RecommendationInfo } from '@app/shared/video/recommendation-info.model'
9import { MiniatureDisplayOptions } from '@app/shared/video/video-miniature.component'
10import { Video } from '@app/shared/video/video.model'
6import { RecommendedVideosStore } from '@app/videos/recommendations/recommended-videos.store' 11import { RecommendedVideosStore } from '@app/videos/recommendations/recommended-videos.store'
7import { User } from '@app/shared'
8import { AuthService, Notifier } from '@app/core'
9import { UserService } from '@app/shared/users/user.service'
10import { I18n } from '@ngx-translate/i18n-polyfill' 12import { I18n } from '@ngx-translate/i18n-polyfill'
11import { SessionStorageService } from '@app/shared/misc/storage.service'
12import { MiniatureDisplayOptions } from '@app/shared/video/video-miniature.component'
13 13
14@Component({ 14@Component({
15 selector: 'my-recommended-videos', 15 selector: 'my-recommended-videos',
16 templateUrl: './recommended-videos.component.html', 16 templateUrl: './recommended-videos.component.html',
17 styleUrls: [ './recommended-videos.component.scss' ] 17 styleUrls: [ './recommended-videos.component.scss' ]
18}) 18})
19export class RecommendedVideosComponent implements OnChanges { 19export class RecommendedVideosComponent implements OnInit, OnChanges {
20 @Input() inputRecommendation: RecommendationInfo 20 @Input() inputRecommendation: RecommendationInfo
21 @Input() user: User
22 @Input() playlist: VideoPlaylist 21 @Input() playlist: VideoPlaylist
23 @Output() gotRecommendations = new EventEmitter<Video[]>() 22 @Output() gotRecommendations = new EventEmitter<Video[]>()
24 23
@@ -32,6 +31,8 @@ export class RecommendedVideosComponent implements OnChanges {
32 avatar: true 31 avatar: true
33 } 32 }
34 33
34 userMiniature: User
35
35 readonly hasVideos$: Observable<boolean> 36 readonly hasVideos$: Observable<boolean>
36 readonly videos$: Observable<Video[]> 37 readonly videos$: Observable<Video[]>
37 38
@@ -59,7 +60,12 @@ export class RecommendedVideosComponent implements OnChanges {
59 this.autoPlayNextVideoTooltip = this.i18n('When active, the next video is automatically played after the current one.') 60 this.autoPlayNextVideoTooltip = this.i18n('When active, the next video is automatically played after the current one.')
60 } 61 }
61 62
62 public ngOnChanges (): void { 63 ngOnInit () {
64 this.userService.getAnonymousOrLoggedUser()
65 .subscribe(user => this.userMiniature = user)
66 }
67
68 ngOnChanges () {
63 if (this.inputRecommendation) { 69 if (this.inputRecommendation) {
64 this.store.requestNewRecommendations(this.inputRecommendation) 70 this.store.requestNewRecommendations(this.inputRecommendation)
65 } 71 }