From fd734688850e04058895c13e576edba3cf6510fc Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 24 Mar 2021 17:06:37 +0100 Subject: Hide best strategy if not logged in --- .../video-list/trending/video-trending-header.component.ts | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'client/src/app') diff --git a/client/src/app/+videos/video-list/trending/video-trending-header.component.ts b/client/src/app/+videos/video-list/trending/video-trending-header.component.ts index 46e65f305..55040f3c9 100644 --- a/client/src/app/+videos/video-list/trending/video-trending-header.component.ts +++ b/client/src/app/+videos/video-list/trending/video-trending-header.component.ts @@ -4,7 +4,7 @@ import { VideoListHeaderComponent } from '@app/shared/shared-video-miniature' import { GlobalIconName } from '@app/shared/shared-icons' import { ServerService } from '@app/core/server/server.service' import { Subscription } from 'rxjs' -import { RedirectService } from '@app/core' +import { AuthService, RedirectService } from '@app/core' interface VideoTrendingHeaderItem { label: string @@ -30,6 +30,7 @@ export class VideoTrendingHeaderComponent extends VideoListHeaderComponent imple @Inject('data') public data: any, private route: ActivatedRoute, private router: Router, + private auth: AuthService, private serverService: ServerService ) { super(data) @@ -67,8 +68,16 @@ export class VideoTrendingHeaderComponent extends VideoListHeaderComponent imple ngOnInit () { this.serverService.getConfig() .subscribe(config => { + const algEnabled = config.trending.videos.algorithms.enabled + this.buttons = this.buttons.map(b => { - b.hidden = !config.trending.videos.algorithms.enabled.includes(b.value) + b.hidden = !algEnabled.includes(b.value) + + // Best is adapted by the user history so + if (b.value === 'best' && !this.auth.isLoggedIn()) { + b.hidden = true + } + return b }) }) -- cgit v1.2.3