aboutsummaryrefslogtreecommitdiffhomepage
path: root/client
diff options
context:
space:
mode:
authorkontrollanten <6680299+kontrollanten@users.noreply.github.com>2020-12-03 07:59:37 +0100
committerChocobozzz <chocobozzz@cpy.re>2020-12-03 09:54:41 +0100
commit09c55770bcc96785fb1f199b4cd8ce66b545486a (patch)
tree04a94f68b48539ae6f541fa3dc72a97ef9235540 /client
parentffc12d3ad5b832602b1098cd3d601feeb618af7c (diff)
downloadPeerTube-09c55770bcc96785fb1f199b4cd8ce66b545486a.tar.gz
PeerTube-09c55770bcc96785fb1f199b4cd8ce66b545486a.tar.zst
PeerTube-09c55770bcc96785fb1f199b4cd8ce66b545486a.zip
register: hide channel step if upload quota is 0
fix #782
Diffstat (limited to 'client')
-rw-r--r--client/src/app/+signup/+register/custom-stepper.component.html2
-rw-r--r--client/src/app/+signup/+register/register-step-user.component.html4
-rw-r--r--client/src/app/+signup/+register/register-step-user.component.ts1
-rw-r--r--client/src/app/+signup/+register/register.component.html6
-rw-r--r--client/src/app/+signup/+register/register.component.ts6
5 files changed, 15 insertions, 4 deletions
diff --git a/client/src/app/+signup/+register/custom-stepper.component.html b/client/src/app/+signup/+register/custom-stepper.component.html
index 57374d41e..4cfe54152 100644
--- a/client/src/app/+signup/+register/custom-stepper.component.html
+++ b/client/src/app/+signup/+register/custom-stepper.component.html
@@ -1,5 +1,5 @@
1<section class="container"> 1<section class="container">
2 <header> 2 <header *ngIf="steps.length > 2">
3 <ng-container *ngFor="let step of steps; let i = index; let isLast = last;"> 3 <ng-container *ngFor="let step of steps; let i = index; let isLast = last;">
4 <div 4 <div
5 class="step-info" [ngClass]="{ active: selectedIndex === i, completed: isCompleted(step) }" [attr.aria-current]="selectedIndex === i" 5 class="step-info" [ngClass]="{ active: selectedIndex === i, completed: isCompleted(step) }" [attr.aria-current]="selectedIndex === i"
diff --git a/client/src/app/+signup/+register/register-step-user.component.html b/client/src/app/+signup/+register/register-step-user.component.html
index edb93b8ed..55fc097d0 100644
--- a/client/src/app/+signup/+register/register-step-user.component.html
+++ b/client/src/app/+signup/+register/register-step-user.component.html
@@ -1,5 +1,9 @@
1<form role="form" [formGroup]="form"> 1<form role="form" [formGroup]="form">
2 2
3 <div class="capability-information alert alert-info" i18n *ngIf="videoUploadDisabled">
4 Video uploads are disabled on this instance, hence your account won't be able to upload videos.
5 </div>
6
3 <div class="form-group"> 7 <div class="form-group">
4 <label for="displayName" i18n>Display name</label> 8 <label for="displayName" i18n>Display name</label>
5 9
diff --git a/client/src/app/+signup/+register/register-step-user.component.ts b/client/src/app/+signup/+register/register-step-user.component.ts
index 65536568b..9193540b4 100644
--- a/client/src/app/+signup/+register/register-step-user.component.ts
+++ b/client/src/app/+signup/+register/register-step-user.component.ts
@@ -19,6 +19,7 @@ import { FormReactive, FormValidatorService } from '@app/shared/shared-forms'
19}) 19})
20export class RegisterStepUserComponent extends FormReactive implements OnInit { 20export class RegisterStepUserComponent extends FormReactive implements OnInit {
21 @Input() hasCodeOfConduct = false 21 @Input() hasCodeOfConduct = false
22 @Input() videoUploadDisabled = false
22 23
23 @Output() formBuilt = new EventEmitter<FormGroup>() 24 @Output() formBuilt = new EventEmitter<FormGroup>()
24 @Output() termsClick = new EventEmitter<void>() 25 @Output() termsClick = new EventEmitter<void>()
diff --git a/client/src/app/+signup/+register/register.component.html b/client/src/app/+signup/+register/register.component.html
index fa9838ba6..7e3704124 100644
--- a/client/src/app/+signup/+register/register.component.html
+++ b/client/src/app/+signup/+register/register.component.html
@@ -13,14 +13,16 @@
13 <cdk-step [stepControl]="formStepUser" i18n-label label="User"> 13 <cdk-step [stepControl]="formStepUser" i18n-label label="User">
14 <my-register-step-user 14 <my-register-step-user
15 [hasCodeOfConduct]="!!aboutHtml.codeOfConduct" 15 [hasCodeOfConduct]="!!aboutHtml.codeOfConduct"
16 [videoUploadDisabled]="videoUploadDisabled"
16 (formBuilt)="onUserFormBuilt($event)" (termsClick)="onTermsClick()" (codeOfConductClick)="onCodeOfConductClick()" 17 (formBuilt)="onUserFormBuilt($event)" (termsClick)="onTermsClick()" (codeOfConductClick)="onCodeOfConductClick()"
17 > 18 >
18 </my-register-step-user> 19 </my-register-step-user>
19 20
20 <button i18n cdkStepperNext [disabled]="!formStepUser || !formStepUser.valid">Next</button> 21 <button i18n cdkStepperNext [disabled]="!formStepUser || !formStepUser.valid"
22 (click)="signup()">{{ videoUploadDisabled ? 'Signup' : 'Next' }}</button>
21 </cdk-step> 23 </cdk-step>
22 24
23 <cdk-step [stepControl]="formStepChannel" i18n-label label="Channel"> 25 <cdk-step [stepControl]="formStepChannel" i18n-label label="Channel" *ngIf="!videoUploadDisabled">
24 <my-register-step-channel (formBuilt)="onChannelFormBuilt($event)" [username]="getUsername()"></my-register-step-channel> 26 <my-register-step-channel (formBuilt)="onChannelFormBuilt($event)" [username]="getUsername()"></my-register-step-channel>
25 27
26 <button i18n cdkStepperNext (click)="signup()" 28 <button i18n cdkStepperNext (click)="signup()"
diff --git a/client/src/app/+signup/+register/register.component.ts b/client/src/app/+signup/+register/register.component.ts
index 153a6d2b5..5b6762631 100644
--- a/client/src/app/+signup/+register/register.component.ts
+++ b/client/src/app/+signup/+register/register.component.ts
@@ -30,6 +30,8 @@ export class RegisterComponent implements OnInit {
30 administrator: '' 30 administrator: ''
31 } 31 }
32 32
33 videoUploadDisabled: boolean
34
33 formStepUser: FormGroup 35 formStepUser: FormGroup
34 formStepChannel: FormGroup 36 formStepChannel: FormGroup
35 37
@@ -52,6 +54,8 @@ export class RegisterComponent implements OnInit {
52 ngOnInit (): void { 54 ngOnInit (): void {
53 this.serverConfig = this.route.snapshot.data.serverConfig 55 this.serverConfig = this.route.snapshot.data.serverConfig
54 56
57 this.videoUploadDisabled = this.serverConfig.user.videoQuota === 0
58
55 this.instanceService.getAbout() 59 this.instanceService.getAbout()
56 .subscribe( 60 .subscribe(
57 async about => { 61 async about => {
@@ -102,7 +106,7 @@ export class RegisterComponent implements OnInit {
102 this.error = null 106 this.error = null
103 107
104 const body: UserRegister = await this.hooks.wrapObject( 108 const body: UserRegister = await this.hooks.wrapObject(
105 Object.assign(this.formStepUser.value, { channel: this.formStepChannel.value }), 109 Object.assign(this.formStepUser.value, { channel: this.videoUploadDisabled ? undefined : this.formStepChannel.value }),
106 'signup', 110 'signup',
107 'filter:api.signup.registration.create.params' 111 'filter:api.signup.registration.create.params'
108 ) 112 )