aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/+videos/video-list
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-06-04 13:31:41 +0200
committerChocobozzz <me@florianbigard.com>2021-06-04 15:45:44 +0200
commit2989628b7913383b39ac34c7db8666a21f8e5037 (patch)
treeac7759177c04e524e7845143fd685aefb49e810e /client/src/app/+videos/video-list
parent8e08d415f9473b6b72fef698729453e726da16e7 (diff)
downloadPeerTube-2989628b7913383b39ac34c7db8666a21f8e5037.tar.gz
PeerTube-2989628b7913383b39ac34c7db8666a21f8e5037.tar.zst
PeerTube-2989628b7913383b39ac34c7db8666a21f8e5037.zip
Use HTML config when possible
Diffstat (limited to 'client/src/app/+videos/video-list')
-rw-r--r--client/src/app/+videos/video-list/trending/video-trending-header.component.ts30
1 files changed, 14 insertions, 16 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 bbb02a236..6c2b32a4f 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
@@ -1,10 +1,10 @@
1import { Subscription } from 'rxjs'
1import { Component, HostBinding, Inject, OnDestroy, OnInit } from '@angular/core' 2import { Component, HostBinding, Inject, OnDestroy, OnInit } from '@angular/core'
2import { ActivatedRoute, Router } from '@angular/router' 3import { ActivatedRoute, Router } from '@angular/router'
3import { VideoListHeaderComponent } from '@app/shared/shared-video-miniature'
4import { GlobalIconName } from '@app/shared/shared-icons'
5import { ServerService } from '@app/core/server/server.service'
6import { Subscription } from 'rxjs'
7import { AuthService, RedirectService } from '@app/core' 4import { AuthService, RedirectService } from '@app/core'
5import { ServerService } from '@app/core/server/server.service'
6import { GlobalIconName } from '@app/shared/shared-icons'
7import { VideoListHeaderComponent } from '@app/shared/shared-video-miniature'
8 8
9interface VideoTrendingHeaderItem { 9interface VideoTrendingHeaderItem {
10 label: string 10 label: string
@@ -67,21 +67,19 @@ export class VideoTrendingHeaderComponent extends VideoListHeaderComponent imple
67 } 67 }
68 68
69 ngOnInit () { 69 ngOnInit () {
70 this.serverService.getConfig() 70 const serverConfig = this.serverService.getHTMLConfig()
71 .subscribe(config => { 71 const algEnabled = serverConfig.trending.videos.algorithms.enabled
72 const algEnabled = config.trending.videos.algorithms.enabled
73 72
74 this.buttons = this.buttons.map(b => { 73 this.buttons = this.buttons.map(b => {
75 b.hidden = !algEnabled.includes(b.value) 74 b.hidden = !algEnabled.includes(b.value)
76 75
77 // Best is adapted by the user history so 76 // Best is adapted by the user history so
78 if (b.value === 'best' && !this.auth.isLoggedIn()) { 77 if (b.value === 'best' && !this.auth.isLoggedIn()) {
79 b.hidden = true 78 b.hidden = true
80 } 79 }
81 80
82 return b 81 return b
83 }) 82 })
84 })
85 83
86 this.algorithmChangeSub = this.route.queryParams.subscribe( 84 this.algorithmChangeSub = this.route.queryParams.subscribe(
87 queryParams => { 85 queryParams => {