diff options
author | Poslovitch <poslovitch@bentobox.world> | 2021-04-24 09:57:01 +0000 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-05-28 13:56:05 +0200 |
commit | 1f256e7d3cf056c2d999260155cdba58ae1b878b (patch) | |
tree | e33db698da50c329e1eea4122e190e6ef247d8e4 /client/src/app/+admin | |
parent | f22e0e2c19b06edfc85429198f9e54a075f71ad3 (diff) | |
download | PeerTube-1f256e7d3cf056c2d999260155cdba58ae1b878b.tar.gz PeerTube-1f256e7d3cf056c2d999260155cdba58ae1b878b.tar.zst PeerTube-1f256e7d3cf056c2d999260155cdba58ae1b878b.zip |
Implemented configurable minimum signup age
Implements https://github.com/Chocobozzz/PeerTube/issues/3612
Fixed lint and removed debug
Fixed another lint error
Apply suggestions from code review
Co-authored-by: Chocobozzz <chocobozzz@cpy.re>
Add tests for min signup age config
Diffstat (limited to 'client/src/app/+admin')
3 files changed, 18 insertions, 3 deletions
diff --git a/client/src/app/+admin/config/edit-custom-config/edit-basic-configuration.component.html b/client/src/app/+admin/config/edit-custom-config/edit-basic-configuration.component.html index 03997ea40..1f542e458 100644 --- a/client/src/app/+admin/config/edit-custom-config/edit-basic-configuration.component.html +++ b/client/src/app/+admin/config/edit-custom-config/edit-basic-configuration.component.html | |||
@@ -158,6 +158,20 @@ | |||
158 | 158 | ||
159 | <small i18n *ngIf="hasUnlimitedSignup()" class="text-muted">Signup won't be limited to a fixed number of users.</small> | 159 | <small i18n *ngIf="hasUnlimitedSignup()" class="text-muted">Signup won't be limited to a fixed number of users.</small> |
160 | </div> | 160 | </div> |
161 | |||
162 | <div [ngClass]="getDisabledSignupClass()" class="mt-3"> | ||
163 | <label i18n for="signupMinimumAge">Minimum required age to create an account</label> | ||
164 | |||
165 | <div class="number-with-unit"> | ||
166 | <input | ||
167 | type="number" min="1" id="signupMinimumAge" class="form-control" | ||
168 | formControlName="minimumAge" [ngClass]="{ 'input-error': formErrors['signup.minimumAge'] }" | ||
169 | > | ||
170 | <span i18n>{form.value['signup']['minimumAge'], plural, =1 {year old} other {years old}}</span> | ||
171 | </div> | ||
172 | |||
173 | <div *ngIf="formErrors.signup.minimumAge" class="form-error">{{ formErrors.signup.minimumAge }}</div> | ||
174 | </div> | ||
161 | </ng-container> | 175 | </ng-container> |
162 | </my-peertube-checkbox> | 176 | </my-peertube-checkbox> |
163 | </div> | 177 | </div> |
@@ -469,7 +483,7 @@ | |||
469 | <ng-container formGroupName="twitter"> | 483 | <ng-container formGroupName="twitter"> |
470 | 484 | ||
471 | <div class="form-group"> | 485 | <div class="form-group"> |
472 | <label i18n for="signupLimit">Your Twitter username</label> | 486 | <label for="servicesTwitterUsername" i18n>Your Twitter username</label> |
473 | 487 | ||
474 | <input | 488 | <input |
475 | type="text" id="servicesTwitterUsername" class="form-control" | 489 | type="text" id="servicesTwitterUsername" class="form-control" |
diff --git a/client/src/app/+admin/config/edit-custom-config/edit-basic-configuration.component.ts b/client/src/app/+admin/config/edit-custom-config/edit-basic-configuration.component.ts index d50148e7a..74fdb87a1 100644 --- a/client/src/app/+admin/config/edit-custom-config/edit-basic-configuration.component.ts +++ b/client/src/app/+admin/config/edit-custom-config/edit-basic-configuration.component.ts | |||
@@ -1,4 +1,3 @@ | |||
1 | |||
2 | import { pairwise } from 'rxjs/operators' | 1 | import { pairwise } from 'rxjs/operators' |
3 | import { SelectOptionsItem } from 'src/types/select-options-item.model' | 2 | import { SelectOptionsItem } from 'src/types/select-options-item.model' |
4 | import { Component, Input, OnChanges, OnInit, SimpleChanges } from '@angular/core' | 3 | import { Component, Input, OnChanges, OnInit, SimpleChanges } from '@angular/core' |
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 dc8334dd0..cb65ca6e7 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 | |||
@@ -21,6 +21,7 @@ import { | |||
21 | SEARCH_INDEX_URL_VALIDATOR, | 21 | SEARCH_INDEX_URL_VALIDATOR, |
22 | SERVICES_TWITTER_USERNAME_VALIDATOR, | 22 | SERVICES_TWITTER_USERNAME_VALIDATOR, |
23 | SIGNUP_LIMIT_VALIDATOR, | 23 | SIGNUP_LIMIT_VALIDATOR, |
24 | SIGNUP_MINIMUM_AGE_VALIDATOR, | ||
24 | TRANSCODING_THREADS_VALIDATOR | 25 | TRANSCODING_THREADS_VALIDATOR |
25 | } from '@app/shared/form-validators/custom-config-validators' | 26 | } from '@app/shared/form-validators/custom-config-validators' |
26 | import { USER_VIDEO_QUOTA_DAILY_VALIDATOR, USER_VIDEO_QUOTA_VALIDATOR } from '@app/shared/form-validators/user-validators' | 27 | import { USER_VIDEO_QUOTA_DAILY_VALIDATOR, USER_VIDEO_QUOTA_VALIDATOR } from '@app/shared/form-validators/user-validators' |
@@ -120,7 +121,8 @@ export class EditCustomConfigComponent extends FormReactive implements OnInit { | |||
120 | signup: { | 121 | signup: { |
121 | enabled: null, | 122 | enabled: null, |
122 | limit: SIGNUP_LIMIT_VALIDATOR, | 123 | limit: SIGNUP_LIMIT_VALIDATOR, |
123 | requiresEmailVerification: null | 124 | requiresEmailVerification: null, |
125 | minimumAge: SIGNUP_MINIMUM_AGE_VALIDATOR | ||
124 | }, | 126 | }, |
125 | import: { | 127 | import: { |
126 | videos: { | 128 | videos: { |