aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-03-24 17:06:37 +0100
committerChocobozzz <me@florianbigard.com>2021-03-24 17:06:37 +0100
commitfd734688850e04058895c13e576edba3cf6510fc (patch)
tree916a94aaa8b47dbc8fb40cfc9946e26024ae5106
parent3cc20a1acae625e55d1fbc79b058d47ec987e27b (diff)
downloadPeerTube-fd734688850e04058895c13e576edba3cf6510fc.tar.gz
PeerTube-fd734688850e04058895c13e576edba3cf6510fc.tar.zst
PeerTube-fd734688850e04058895c13e576edba3cf6510fc.zip
Hide best strategy if not logged in
-rw-r--r--client/src/app/+videos/video-list/trending/video-trending-header.component.ts13
1 files changed, 11 insertions, 2 deletions
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'
4import { GlobalIconName } from '@app/shared/shared-icons' 4import { GlobalIconName } from '@app/shared/shared-icons'
5import { ServerService } from '@app/core/server/server.service' 5import { ServerService } from '@app/core/server/server.service'
6import { Subscription } from 'rxjs' 6import { Subscription } from 'rxjs'
7import { RedirectService } from '@app/core' 7import { AuthService, RedirectService } from '@app/core'
8 8
9interface VideoTrendingHeaderItem { 9interface VideoTrendingHeaderItem {
10 label: string 10 label: string
@@ -30,6 +30,7 @@ export class VideoTrendingHeaderComponent extends VideoListHeaderComponent imple
30 @Inject('data') public data: any, 30 @Inject('data') public data: any,
31 private route: ActivatedRoute, 31 private route: ActivatedRoute,
32 private router: Router, 32 private router: Router,
33 private auth: AuthService,
33 private serverService: ServerService 34 private serverService: ServerService
34 ) { 35 ) {
35 super(data) 36 super(data)
@@ -67,8 +68,16 @@ export class VideoTrendingHeaderComponent extends VideoListHeaderComponent imple
67 ngOnInit () { 68 ngOnInit () {
68 this.serverService.getConfig() 69 this.serverService.getConfig()
69 .subscribe(config => { 70 .subscribe(config => {
71 const algEnabled = config.trending.videos.algorithms.enabled
72
70 this.buttons = this.buttons.map(b => { 73 this.buttons = this.buttons.map(b => {
71 b.hidden = !config.trending.videos.algorithms.enabled.includes(b.value) 74 b.hidden = !algEnabled.includes(b.value)
75
76 // Best is adapted by the user history so
77 if (b.value === 'best' && !this.auth.isLoggedIn()) {
78 b.hidden = true
79 }
80
72 return b 81 return b
73 }) 82 })
74 }) 83 })