diff options
-rw-r--r-- | client/src/app/+videos/video-list/trending/video-trending-header.component.ts | 13 |
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' | |||
4 | import { GlobalIconName } from '@app/shared/shared-icons' | 4 | import { GlobalIconName } from '@app/shared/shared-icons' |
5 | import { ServerService } from '@app/core/server/server.service' | 5 | import { ServerService } from '@app/core/server/server.service' |
6 | import { Subscription } from 'rxjs' | 6 | import { Subscription } from 'rxjs' |
7 | import { RedirectService } from '@app/core' | 7 | import { AuthService, RedirectService } from '@app/core' |
8 | 8 | ||
9 | interface VideoTrendingHeaderItem { | 9 | interface 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 | }) |