aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/+admin
diff options
context:
space:
mode:
Diffstat (limited to 'client/src/app/+admin')
-rw-r--r--client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.html2
-rw-r--r--client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.scss5
-rw-r--r--client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.ts28
3 files changed, 35 insertions, 0 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 f8f379d47..e0361fbfd 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
@@ -351,6 +351,8 @@
351 > 351 >
352 <ng-container ngProjectAs="description"> 352 <ng-container ngProjectAs="description">
353 <span i18n>⚠️ This functionality requires a lot of attention and extra moderation.</span> 353 <span i18n>⚠️ This functionality requires a lot of attention and extra moderation.</span>
354
355 <div class="alert alert-info alert-signup" *ngIf="signupAlertMessage">{{ signupAlertMessage }}</div>
354 </ng-container> 356 </ng-container>
355 <ng-container ngProjectAs="extra"> 357 <ng-container ngProjectAs="extra">
356 <my-peertube-checkbox [ngClass]="{ 'disabled-checkbox-extra': !isSignupEnabled() }" 358 <my-peertube-checkbox [ngClass]="{ 'disabled-checkbox-extra': !isSignupEnabled() }"
diff --git a/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.scss b/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.scss
index f8f2d5fdc..14cd6bd8b 100644
--- a/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.scss
+++ b/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.scss
@@ -87,3 +87,8 @@ ngb-tabset:not(.previews) ::ng-deep {
87.submit-error { 87.submit-error {
88 margin-bottom: 20px; 88 margin-bottom: 20px;
89} 89}
90
91.alert-signup {
92 width: fit-content;
93 margin-top: 10px;
94}
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}