1
0
Fork 0

register: hide channel step if upload quota is 0

fix #782
This commit is contained in:
kontrollanten 2020-12-03 07:59:37 +01:00 committed by Chocobozzz
parent ffc12d3ad5
commit 09c55770bc
5 changed files with 15 additions and 4 deletions

View file

@ -1,5 +1,5 @@
<section class="container">
<header>
<header *ngIf="steps.length > 2">
<ng-container *ngFor="let step of steps; let i = index; let isLast = last;">
<div
class="step-info" [ngClass]="{ active: selectedIndex === i, completed: isCompleted(step) }" [attr.aria-current]="selectedIndex === i"

View file

@ -1,5 +1,9 @@
<form role="form" [formGroup]="form">
<div class="capability-information alert alert-info" i18n *ngIf="videoUploadDisabled">
Video uploads are disabled on this instance, hence your account won't be able to upload videos.
</div>
<div class="form-group">
<label for="displayName" i18n>Display name</label>

View file

@ -19,6 +19,7 @@ import { FormReactive, FormValidatorService } from '@app/shared/shared-forms'
})
export class RegisterStepUserComponent extends FormReactive implements OnInit {
@Input() hasCodeOfConduct = false
@Input() videoUploadDisabled = false
@Output() formBuilt = new EventEmitter<FormGroup>()
@Output() termsClick = new EventEmitter<void>()

View file

@ -13,14 +13,16 @@
<cdk-step [stepControl]="formStepUser" i18n-label label="User">
<my-register-step-user
[hasCodeOfConduct]="!!aboutHtml.codeOfConduct"
[videoUploadDisabled]="videoUploadDisabled"
(formBuilt)="onUserFormBuilt($event)" (termsClick)="onTermsClick()" (codeOfConductClick)="onCodeOfConductClick()"
>
</my-register-step-user>
<button i18n cdkStepperNext [disabled]="!formStepUser || !formStepUser.valid">Next</button>
<button i18n cdkStepperNext [disabled]="!formStepUser || !formStepUser.valid"
(click)="signup()">{{ videoUploadDisabled ? 'Signup' : 'Next' }}</button>
</cdk-step>
<cdk-step [stepControl]="formStepChannel" i18n-label label="Channel">
<cdk-step [stepControl]="formStepChannel" i18n-label label="Channel" *ngIf="!videoUploadDisabled">
<my-register-step-channel (formBuilt)="onChannelFormBuilt($event)" [username]="getUsername()"></my-register-step-channel>
<button i18n cdkStepperNext (click)="signup()"

View file

@ -30,6 +30,8 @@ export class RegisterComponent implements OnInit {
administrator: ''
}
videoUploadDisabled: boolean
formStepUser: FormGroup
formStepChannel: FormGroup
@ -52,6 +54,8 @@ export class RegisterComponent implements OnInit {
ngOnInit (): void {
this.serverConfig = this.route.snapshot.data.serverConfig
this.videoUploadDisabled = this.serverConfig.user.videoQuota === 0
this.instanceService.getAbout()
.subscribe(
async about => {
@ -102,7 +106,7 @@ export class RegisterComponent implements OnInit {
this.error = null
const body: UserRegister = await this.hooks.wrapObject(
Object.assign(this.formStepUser.value, { channel: this.formStepChannel.value }),
Object.assign(this.formStepUser.value, { channel: this.videoUploadDisabled ? undefined : this.formStepChannel.value }),
'signup',
'filter:api.signup.registration.create.params'
)