mirror of https://github.com/Chocobozzz/PeerTube
Automatically enable videos auto block on signup
parent
0aa52e1707
commit
16a173bbc9
|
@ -351,6 +351,8 @@
|
||||||
>
|
>
|
||||||
<ng-container ngProjectAs="description">
|
<ng-container ngProjectAs="description">
|
||||||
<span i18n>⚠️ This functionality requires a lot of attention and extra moderation.</span>
|
<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>
|
||||||
<ng-container ngProjectAs="extra">
|
<ng-container ngProjectAs="extra">
|
||||||
<my-peertube-checkbox [ngClass]="{ 'disabled-checkbox-extra': !isSignupEnabled() }"
|
<my-peertube-checkbox [ngClass]="{ 'disabled-checkbox-extra': !isSignupEnabled() }"
|
||||||
|
|
|
@ -87,3 +87,8 @@ ngb-tabset:not(.previews) ::ng-deep {
|
||||||
.submit-error {
|
.submit-error {
|
||||||
margin-bottom: 20px;
|
margin-bottom: 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.alert-signup {
|
||||||
|
width: fit-content;
|
||||||
|
margin-top: 10px;
|
||||||
|
}
|
||||||
|
|
|
@ -20,6 +20,7 @@ import { USER_VIDEO_QUOTA_DAILY_VALIDATOR, USER_VIDEO_QUOTA_VALIDATOR } from '@a
|
||||||
import { FormReactive, FormValidatorService, SelectOptionsItem } from '@app/shared/shared-forms'
|
import { FormReactive, FormValidatorService, SelectOptionsItem } from '@app/shared/shared-forms'
|
||||||
import { NgbNav } from '@ng-bootstrap/ng-bootstrap'
|
import { NgbNav } from '@ng-bootstrap/ng-bootstrap'
|
||||||
import { CustomConfig, ServerConfig } from '@shared/models'
|
import { CustomConfig, ServerConfig } from '@shared/models'
|
||||||
|
import { pairwise } from 'rxjs/operators'
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'my-edit-custom-config',
|
selector: 'my-edit-custom-config',
|
||||||
|
@ -41,6 +42,8 @@ export class EditCustomConfigComponent extends FormReactive implements OnInit, A
|
||||||
languageItems: SelectOptionsItem[] = []
|
languageItems: SelectOptionsItem[] = []
|
||||||
categoryItems: SelectOptionsItem[] = []
|
categoryItems: SelectOptionsItem[] = []
|
||||||
|
|
||||||
|
signupAlertMessage: string
|
||||||
|
|
||||||
private serverConfig: ServerConfig
|
private serverConfig: ServerConfig
|
||||||
|
|
||||||
constructor (
|
constructor (
|
||||||
|
@ -293,7 +296,9 @@ export class EditCustomConfigComponent extends FormReactive implements OnInit, A
|
||||||
|
|
||||||
this.buildForm(formGroupData)
|
this.buildForm(formGroupData)
|
||||||
this.loadForm()
|
this.loadForm()
|
||||||
|
|
||||||
this.checkTranscodingFields()
|
this.checkTranscodingFields()
|
||||||
|
this.checkSignupField()
|
||||||
}
|
}
|
||||||
|
|
||||||
ngAfterViewChecked () {
|
ngAfterViewChecked () {
|
||||||
|
@ -428,4 +433,27 @@ export class EditCustomConfigComponent extends FormReactive implements OnInit, A
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue