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 --- .../recommended-videos.component.ts | 26 +++++++++++++--------- 1 file changed, 16 insertions(+), 10 deletions(-) (limited to 'client/src/app/videos/recommendations/recommended-videos.component.ts') 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 @@ -import { Component, Input, Output, OnChanges, EventEmitter } from '@angular/core' import { Observable } from 'rxjs' -import { Video } from '@app/shared/video/video.model' +import { Component, EventEmitter, Input, OnChanges, OnInit, Output } from '@angular/core' +import { AuthService, Notifier } from '@app/core' +import { User } from '@app/shared' +import { SessionStorageService } from '@app/shared/misc/storage.service' +import { UserService } from '@app/shared/users/user.service' import { VideoPlaylist } from '@app/shared/video-playlist/video-playlist.model' import { RecommendationInfo } from '@app/shared/video/recommendation-info.model' +import { MiniatureDisplayOptions } from '@app/shared/video/video-miniature.component' +import { Video } from '@app/shared/video/video.model' import { RecommendedVideosStore } from '@app/videos/recommendations/recommended-videos.store' -import { User } from '@app/shared' -import { AuthService, Notifier } from '@app/core' -import { UserService } from '@app/shared/users/user.service' import { I18n } from '@ngx-translate/i18n-polyfill' -import { SessionStorageService } from '@app/shared/misc/storage.service' -import { MiniatureDisplayOptions } from '@app/shared/video/video-miniature.component' @Component({ selector: 'my-recommended-videos', templateUrl: './recommended-videos.component.html', styleUrls: [ './recommended-videos.component.scss' ] }) -export class RecommendedVideosComponent implements OnChanges { +export class RecommendedVideosComponent implements OnInit, OnChanges { @Input() inputRecommendation: RecommendationInfo - @Input() user: User @Input() playlist: VideoPlaylist @Output() gotRecommendations = new EventEmitter() @@ -32,6 +31,8 @@ export class RecommendedVideosComponent implements OnChanges { avatar: true } + userMiniature: User + readonly hasVideos$: Observable readonly videos$: Observable @@ -59,7 +60,12 @@ export class RecommendedVideosComponent implements OnChanges { this.autoPlayNextVideoTooltip = this.i18n('When active, the next video is automatically played after the current one.') } - public ngOnChanges (): void { + ngOnInit () { + this.userService.getAnonymousOrLoggedUser() + .subscribe(user => this.userMiniature = user) + } + + ngOnChanges () { if (this.inputRecommendation) { this.store.requestNewRecommendations(this.inputRecommendation) } -- cgit v1.2.3