aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2020-11-18 15:55:19 +0100
committerChocobozzz <me@florianbigard.com>2020-11-18 16:13:38 +0100
commit16a173bbc98509705105eec8189fa5543d9673c7 (patch)
treeff88fa64fedda6c991d8f4b3a663778391e4236b /client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.ts
parent0aa52e170727ac6bdf441bcaa2353ae0b8a354ed (diff)
downloadPeerTube-16a173bbc98509705105eec8189fa5543d9673c7.tar.gz
PeerTube-16a173bbc98509705105eec8189fa5543d9673c7.tar.zst
PeerTube-16a173bbc98509705105eec8189fa5543d9673c7.zip
Automatically enable videos auto block on signup
Diffstat (limited to 'client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.ts')
-rw-r--r--client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.ts28
1 files changed, 28 insertions, 0 deletions
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 d442df0e3..7db65d038 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
@@ -20,6 +20,7 @@ import { USER_VIDEO_QUOTA_DAILY_VALIDATOR, USER_VIDEO_QUOTA_VALIDATOR } from '@a
20import { FormReactive, FormValidatorService, SelectOptionsItem } from '@app/shared/shared-forms' 20import { FormReactive, FormValidatorService, SelectOptionsItem } from '@app/shared/shared-forms'
21import { NgbNav } from '@ng-bootstrap/ng-bootstrap' 21import { NgbNav } from '@ng-bootstrap/ng-bootstrap'
22import { CustomConfig, ServerConfig } from '@shared/models' 22import { CustomConfig, ServerConfig } from '@shared/models'
23import { pairwise } from 'rxjs/operators'
23 24
24@Component({ 25@Component({
25 selector: 'my-edit-custom-config', 26 selector: 'my-edit-custom-config',
@@ -41,6 +42,8 @@ export class EditCustomConfigComponent extends FormReactive implements OnInit, A
41 languageItems: SelectOptionsItem[] = [] 42 languageItems: SelectOptionsItem[] = []
42 categoryItems: SelectOptionsItem[] = [] 43 categoryItems: SelectOptionsItem[] = []
43 44
45 signupAlertMessage: string
46
44 private serverConfig: ServerConfig 47 private serverConfig: ServerConfig
45 48
46 constructor ( 49 constructor (
@@ -293,7 +296,9 @@ export class EditCustomConfigComponent extends FormReactive implements OnInit, A
293 296
294 this.buildForm(formGroupData) 297 this.buildForm(formGroupData)
295 this.loadForm() 298 this.loadForm()
299
296 this.checkTranscodingFields() 300 this.checkTranscodingFields()
301 this.checkSignupField()
297 } 302 }
298 303
299 ngAfterViewChecked () { 304 ngAfterViewChecked () {
@@ -428,4 +433,27 @@ export class EditCustomConfigComponent extends FormReactive implements OnInit, A
428 } 433 }
429 }) 434 })
430 } 435 }
436
437 private checkSignupField () {
438 const signupControl = this.form.get('signup.enabled')
439
440 signupControl.valueChanges
441 .pipe(pairwise())
442 .subscribe(([ oldValue, newValue ]) => {
443 if (oldValue !== true && newValue === true) {
444 // tslint:disable:max-line-length
445 this.signupAlertMessage = $localize`You enabled signup: we automatically enabled the "Block new videos automatically" checkbox of the "Videos" section just below.`
446
447 this.form.patchValue({
448 autoBlacklist: {
449 videos: {
450 ofUsers: {
451 enabled: true
452 }
453 }
454 }
455 })
456 }
457 })
458 }
431} 459}