>
<ng-container ngProjectAs="description">
<span i18n>⚠️ This functionality requires a lot of attention and extra moderation.</span>
+
+ <div class="alert alert-info alert-signup" *ngIf="signupAlertMessage">{{ signupAlertMessage }}</div>
</ng-container>
<ng-container ngProjectAs="extra">
<my-peertube-checkbox [ngClass]="{ 'disabled-checkbox-extra': !isSignupEnabled() }"
import { FormReactive, FormValidatorService, SelectOptionsItem } from '@app/shared/shared-forms'
import { NgbNav } from '@ng-bootstrap/ng-bootstrap'
import { CustomConfig, ServerConfig } from '@shared/models'
+import { pairwise } from 'rxjs/operators'
@Component({
selector: 'my-edit-custom-config',
languageItems: SelectOptionsItem[] = []
categoryItems: SelectOptionsItem[] = []
+ signupAlertMessage: string
+
private serverConfig: ServerConfig
constructor (
this.buildForm(formGroupData)
this.loadForm()
+
this.checkTranscodingFields()
+ this.checkSignupField()
}
ngAfterViewChecked () {
}
})
}
+
+ private checkSignupField () {
+ const signupControl = this.form.get('signup.enabled')
+
+ signupControl.valueChanges
+ .pipe(pairwise())
+ .subscribe(([ oldValue, newValue ]) => {
+ if (oldValue !== true && newValue === true) {
+ // tslint:disable:max-line-length
+ this.signupAlertMessage = $localize`You enabled signup: we automatically enabled the "Block new videos automatically" checkbox of the "Videos" section just below.`
+
+ this.form.patchValue({
+ autoBlacklist: {
+ videos: {
+ ofUsers: {
+ enabled: true
+ }
+ }
+ }
+ })
+ }
+ })
+ }
}