diff options
author | Chocobozzz <me@florianbigard.com> | 2022-04-15 15:07:20 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2022-04-15 15:07:20 +0200 |
commit | 2b0d17ccf46cfdba4103b7287f0dadf289ad4faf (patch) | |
tree | 3b006eff6a32126d8c260f99f561e2ac1901e4d1 /client/src/app/shared/shared-video-miniature | |
parent | d09ed46e71b78b4874de4afabefa2f9453c5894d (diff) | |
download | PeerTube-2b0d17ccf46cfdba4103b7287f0dadf289ad4faf.tar.gz PeerTube-2b0d17ccf46cfdba4103b7287f0dadf289ad4faf.tar.zst PeerTube-2b0d17ccf46cfdba4103b7287f0dadf289ad4faf.zip |
Reduce videos sort complexity
Automatically use best sort if user is logged in and chose hot algorithm
Diffstat (limited to 'client/src/app/shared/shared-video-miniature')
-rw-r--r-- | client/src/app/shared/shared-video-miniature/video-filters-header.component.html | 1 | ||||
-rw-r--r-- | client/src/app/shared/shared-video-miniature/video-filters-header.component.ts | 9 |
2 files changed, 2 insertions, 8 deletions
diff --git a/client/src/app/shared/shared-video-miniature/video-filters-header.component.html b/client/src/app/shared/shared-video-miniature/video-filters-header.component.html index 7f5692dd4..fc34b1b29 100644 --- a/client/src/app/shared/shared-video-miniature/video-filters-header.component.html +++ b/client/src/app/shared/shared-video-miniature/video-filters-header.component.html | |||
@@ -47,7 +47,6 @@ | |||
47 | 47 | ||
48 | <ng-option i18n *ngIf="isTrendingSortEnabled('most-viewed')" value="-trending">Sort by <strong>"Recent Views"</strong></ng-option> | 48 | <ng-option i18n *ngIf="isTrendingSortEnabled('most-viewed')" value="-trending">Sort by <strong>"Recent Views"</strong></ng-option> |
49 | <ng-option i18n *ngIf="isTrendingSortEnabled('hot')" value="-hot">Sort by <strong>"Hot"</strong></ng-option> | 49 | <ng-option i18n *ngIf="isTrendingSortEnabled('hot')" value="-hot">Sort by <strong>"Hot"</strong></ng-option> |
50 | <ng-option i18n *ngIf="isTrendingSortEnabled('best')" value="-best">Sort by <strong>"Best"</strong></ng-option> | ||
51 | <ng-option i18n *ngIf="isTrendingSortEnabled('most-liked')" value="-likes">Sort by <strong>"Likes"</strong></ng-option> | 50 | <ng-option i18n *ngIf="isTrendingSortEnabled('most-liked')" value="-likes">Sort by <strong>"Likes"</strong></ng-option> |
52 | </ng-select> | 51 | </ng-select> |
53 | 52 | ||
diff --git a/client/src/app/shared/shared-video-miniature/video-filters-header.component.ts b/client/src/app/shared/shared-video-miniature/video-filters-header.component.ts index 2c52e43f7..7b806248b 100644 --- a/client/src/app/shared/shared-video-miniature/video-filters-header.component.ts +++ b/client/src/app/shared/shared-video-miniature/video-filters-header.component.ts | |||
@@ -72,15 +72,10 @@ export class VideoFiltersHeaderComponent implements OnInit, OnDestroy { | |||
72 | return this.auth.getUser().hasRight(UserRight.SEE_ALL_VIDEOS) | 72 | return this.auth.getUser().hasRight(UserRight.SEE_ALL_VIDEOS) |
73 | } | 73 | } |
74 | 74 | ||
75 | isTrendingSortEnabled (sort: 'most-viewed' | 'hot' | 'best' | 'most-liked') { | 75 | isTrendingSortEnabled (sort: 'most-viewed' | 'hot' | 'most-liked') { |
76 | const serverConfig = this.serverService.getHTMLConfig() | 76 | const serverConfig = this.serverService.getHTMLConfig() |
77 | 77 | ||
78 | const enabled = serverConfig.trending.videos.algorithms.enabled.includes(sort) | 78 | return serverConfig.trending.videos.algorithms.enabled.includes(sort) |
79 | |||
80 | // Best is adapted from the user | ||
81 | if (sort === 'best') return enabled && this.auth.isLoggedIn() | ||
82 | |||
83 | return enabled | ||
84 | } | 79 | } |
85 | 80 | ||
86 | resetFilter (key: string, canRemove: boolean) { | 81 | resetFilter (key: string, canRemove: boolean) { |