Fix signup limit validator, and add warning message.
authorRigel Kent <sendmemail@rigelk.eu>
Thu, 30 Jan 2020 23:59:41 +0000 (00:59 +0100)
committerChocobozzz <chocobozzz@cpy.re>
Fri, 31 Jan 2020 07:56:20 +0000 (08:56 +0100)
client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.html
client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.scss
client/src/app/shared/forms/form-validators/custom-config-validators.service.ts
client/src/sass/include/_mixins.scss

index 915d60090c3b8ab8cbd7c4dec3209d59a3c1a225..d806ea355e9dfc5304f5c4f8d97de84dac697e11 100644 (file)
               inputName="signupEnabled" formControlName="enabled"
               i18n-labelText labelText="Signup enabled"
             >
+              <ng-container ngProjectAs="description">
+                <span i18n>⚠️ This functionality requires a lot of attention and extra moderation.</span>
+              </ng-container>
               <ng-container ngProjectAs="extra">
                 <my-peertube-checkbox [ngClass]="{ 'disabled-checkbox-extra': !isSignupEnabled() }"
                   inputName="signupRequiresEmailVerification" formControlName="requiresEmailVerification"
                 <div [ngClass]="{ 'disabled-checkbox-extra': !isSignupEnabled() }" class="mt-3">
                   <label i18n for="signupLimit">Signup limit</label>
                   <input
-                    type="text" id="signupLimit"
+                    type="number" min="-1" id="signupLimit"
                     formControlName="limit" [ngClass]="{ 'input-error': formErrors['signup.limit'] }"
                   >
                   <div *ngIf="formErrors.signup.limit" class="form-error">{{ formErrors.signup.limit }}</div>
+                  <small *ngIf="form.value['signup']['limit'] === -1" class="text-muted">Signup won't be limited to a fixed number of users.</small>
                 </div>
               </ng-container>
             </my-peertube-checkbox>
                   i18n-labelText labelText="Blacklist new videos automatically"
                 >
                 <ng-container ngProjectAs="description">
-                  <span i18n>Videos of regular users will stay private until a moderator reviews them. Can be overriden per user.</span>
+                  <span i18n>Unless a user is marked as trusted, their videos will stay private until a moderator reviews them.</span>
                 </ng-container>
               </my-peertube-checkbox>
               </div>
index 60d608028c3a1c72c3ff51fc8e9aa46b56322e72..dd70f1c0664a91420293cb1600243c9f4414d48c 100644 (file)
@@ -10,6 +10,11 @@ input[type=text] {
   display: block;
 }
 
+input[type=number] {
+  @include peertube-input-text(315px);
+  display: block;
+}
+
 input[type=checkbox] {
   @include peertube-checkbox(1px);
 }
index 767e3f026844632ae6a786067a7c79196de6e8ec..d20754d11dd0b1f5aec80b3344b5ccc1be43c0d5 100644 (file)
@@ -56,7 +56,7 @@ export class CustomConfigValidatorsService {
     }
 
     this.SIGNUP_LIMIT = {
-      VALIDATORS: [ Validators.required, Validators.min(1), Validators.pattern('[0-9]+') ],
+      VALIDATORS: [ Validators.required, Validators.min(-1), Validators.pattern('-?[0-9]+') ],
       MESSAGES: {
         'required': this.i18n('Signup limit is required.'),
         'min': this.i18n('Signup limit must be greater than 1.'),
index ee86a32d4670b478d958f49d99ddc22c51508cbb..317781e0e9755ad077db1f27d205a1f1a6e3cd1a 100644 (file)
   }
 }
 
+@mixin button-focus-visible-shadow($color) {
+  &.focus-visible {
+    box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 4px $color;
+  }
+}
+
 @mixin peertube-input-text($width) {
   display: inline-block;
   height: $button-height;
 }
 
 @mixin orange-button {
+  @include button-focus-visible-shadow(var(--mainHoverColor));
+
   &, &:active, &:focus {
     color: #fff;
     background-color: var(--mainColor);
   text-align: center;
   padding: 0 17px 0 13px;
   cursor: pointer;
-  outline: 0;
 }
 
 @mixin peertube-button-link {