aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-03-24 17:06:37 +0100
committerChocobozzz <me@florianbigard.com>2021-03-24 18:18:40 +0100
commite6ea0cac4473037df16437a4a128aa6d76a1cfdc (patch)
tree4af7b3bb2a92ba2b56fe147590521cbcb4244a1b /client/src/app
parenta3caabe22844ef9d10880629a161662b5ac7a8ea (diff)
downloadPeerTube-e6ea0cac4473037df16437a4a128aa6d76a1cfdc.tar.gz
PeerTube-e6ea0cac4473037df16437a4a128aa6d76a1cfdc.tar.zst
PeerTube-e6ea0cac4473037df16437a4a128aa6d76a1cfdc.zip
Hide best strategy if not logged in
Diffstat (limited to 'client/src/app')
-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 })