diff options
author | Rigel Kent <sendmemail@rigelk.eu> | 2021-01-27 17:15:21 +0100 |
---|---|---|
committer | Chocobozzz <chocobozzz@cpy.re> | 2021-01-28 15:55:34 +0100 |
commit | ba5d4a849c7d7ba05f093480ae12286c4af61556 (patch) | |
tree | 704a80b96d3b437ad12feacaaaf58a96b97282a1 /client/src/app/+admin | |
parent | 3da68f0a781ebd893521e2e6fa200280c92ae815 (diff) | |
download | PeerTube-ba5d4a849c7d7ba05f093480ae12286c4af61556.tar.gz PeerTube-ba5d4a849c7d7ba05f093480ae12286c4af61556.tar.zst PeerTube-ba5d4a849c7d7ba05f093480ae12286c4af61556.zip |
move from trending routes to alg param
Diffstat (limited to 'client/src/app/+admin')
-rw-r--r-- | client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.html | 32 | ||||
-rw-r--r-- | client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.ts | 18 |
2 files changed, 27 insertions, 23 deletions
diff --git a/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.html b/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.html index 83b1c6a31..dd62a4aab 100644 --- a/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.html +++ b/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.html | |||
@@ -271,10 +271,9 @@ | |||
271 | <option i18n value="/videos/overview">Discover videos</option> | 271 | <option i18n value="/videos/overview">Discover videos</option> |
272 | <optgroup i18n-label label="Trending pages"> | 272 | <optgroup i18n-label label="Trending pages"> |
273 | <option i18n value="/videos/trending">Default trending page</option> | 273 | <option i18n value="/videos/trending">Default trending page</option> |
274 | <option i18n value="/videos/hot" *ngIf="isTrendingHotEnabled()">Hot videos</option> | 274 | <option i18n value="/videos/trending?alg=hot" [disabled]="!trendingVideosAlgorithmsEnabledIncludes('hot')">Hot videos</option> |
275 | <option i18n value="/videos/hot" *ngIf="!isTrendingHotEnabled()" disabled>Hot videos</option> | 275 | <option i18n value="/videos/trending?alg=most-viewed" [disabled]="!trendingVideosAlgorithmsEnabledIncludes('most-viewed')">Most viewed videos</option> |
276 | <option i18n value="/videos/most-viewed">Most viewed videos</option> | 276 | <option i18n value="/videos/trending?alg=most-liked" [disabled]="!trendingVideosAlgorithmsEnabledIncludes('most-liked')">Most liked videos</option> |
277 | <option i18n value="/videos/most-liked">Most liked videos</option> | ||
278 | </optgroup> | 277 | </optgroup> |
279 | <option i18n value="/videos/recently-added">Recently added videos</option> | 278 | <option i18n value="/videos/recently-added">Recently added videos</option> |
280 | <option i18n value="/videos/local">Local videos</option> | 279 | <option i18n value="/videos/local">Local videos</option> |
@@ -283,17 +282,20 @@ | |||
283 | <div *ngIf="formErrors.instance.defaultClientRoute" class="form-error">{{ formErrors.instance.defaultClientRoute }}</div> | 282 | <div *ngIf="formErrors.instance.defaultClientRoute" class="form-error">{{ formErrors.instance.defaultClientRoute }}</div> |
284 | </div> | 283 | </div> |
285 | 284 | ||
286 | <div class="form-group" formGroupName="instance"> | 285 | <div class="form-group" formGroupName="trending"> |
287 | <label i18n for="instanceDefaultTrendingRoute">Default trending page</label> | 286 | <ng-container formGroupName="videos"> |
288 | <div class="peertube-select-container"> | 287 | <ng-container formGroupName="algorithms"> |
289 | <select id="instanceDefaultTrendingRoute" formControlName="defaultTrendingRoute" class="form-control"> | 288 | <label i18n for="trendingVideosAlgorithmsDefault">Default trending page</label> |
290 | <option i18n value="/videos/hot" *ngIf="isTrendingHotEnabled()">Hot videos</option> | 289 | <div class="peertube-select-container"> |
291 | <option i18n value="/videos/hot" *ngIf="!isTrendingHotEnabled()" disabled>Hot videos</option> | 290 | <select id="trendingVideosAlgorithmsDefault" formControlName="default" class="form-control"> |
292 | <option i18n value="/videos/trending">Most viewed videos</option> | 291 | <option i18n value="hot">Hot videos</option> |
293 | <option i18n value="/videos/most-liked">Most liked videos</option> | 292 | <option i18n value="most-viewed">Most viewed videos</option> |
294 | </select> | 293 | <option i18n value="most-liked">Most liked videos</option> |
295 | </div> | 294 | </select> |
296 | <div *ngIf="formErrors.instance.defaultTrendingRoute" class="form-error">{{ formErrors.instance.defaultTrendingRoute }}</div> | 295 | </div> |
296 | <div *ngIf="formErrors.trending.videos.algorithms.default" class="form-error">{{ formErrors.trending.videos.algorithms.default }}</div> | ||
297 | </ng-container> | ||
298 | </ng-container> | ||
297 | </div> | 299 | </div> |
298 | 300 | ||
299 | </div> | 301 | </div> |
diff --git a/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.ts b/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.ts index e6fc4582b..9a46a2e59 100644 --- a/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.ts +++ b/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.ts | |||
@@ -186,12 +186,6 @@ export class EditCustomConfigComponent extends FormReactive implements OnInit, A | |||
186 | languages: null, | 186 | languages: null, |
187 | 187 | ||
188 | defaultClientRoute: null, | 188 | defaultClientRoute: null, |
189 | defaultTrendingRoute: null, | ||
190 | pages: { | ||
191 | hot: { | ||
192 | enabled: null | ||
193 | } | ||
194 | }, | ||
195 | 189 | ||
196 | customizations: { | 190 | customizations: { |
197 | javascript: null, | 191 | javascript: null, |
@@ -230,6 +224,14 @@ export class EditCustomConfigComponent extends FormReactive implements OnInit, A | |||
230 | } | 224 | } |
231 | } | 225 | } |
232 | }, | 226 | }, |
227 | trending: { | ||
228 | videos: { | ||
229 | algorithms: { | ||
230 | enabled: null, | ||
231 | default: null | ||
232 | } | ||
233 | } | ||
234 | }, | ||
233 | admin: { | 235 | admin: { |
234 | email: ADMIN_EMAIL_VALIDATOR | 236 | email: ADMIN_EMAIL_VALIDATOR |
235 | }, | 237 | }, |
@@ -370,8 +372,8 @@ export class EditCustomConfigComponent extends FormReactive implements OnInit, A | |||
370 | return this.form.value['followings']['instance']['autoFollowIndex']['enabled'] === true | 372 | return this.form.value['followings']['instance']['autoFollowIndex']['enabled'] === true |
371 | } | 373 | } |
372 | 374 | ||
373 | isTrendingHotEnabled () { | 375 | trendingVideosAlgorithmsEnabledIncludes (algorithm: string) { |
374 | return this.form.value['instance']['pages']['hot']['enabled'] === true | 376 | return this.form.value['trending']['videos']['algorithms']['enabled'].find((e: string) => e === algorithm) |
375 | } | 377 | } |
376 | 378 | ||
377 | async formValidated () { | 379 | async formValidated () { |