diff options
author | Chocobozzz <me@florianbigard.com> | 2020-01-21 10:47:56 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2020-01-21 10:47:56 +0100 |
commit | 4ee6a8b13edb0dd6186139f3a6589b06139f464b (patch) | |
tree | cfde5fc6215500a94047037e58861a44adaa5eab /client/src/app/+admin/config/edit-custom-config | |
parent | 7738273b808f0ff1494f18c4cc13553505e6ac6d (diff) | |
download | PeerTube-4ee6a8b13edb0dd6186139f3a6589b06139f464b.tar.gz PeerTube-4ee6a8b13edb0dd6186139f3a6589b06139f464b.tar.zst PeerTube-4ee6a8b13edb0dd6186139f3a6589b06139f464b.zip |
Fix admin config form for auto follow
Diffstat (limited to 'client/src/app/+admin/config/edit-custom-config')
-rw-r--r-- | client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.html | 17 | ||||
-rw-r--r-- | client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.ts | 6 |
2 files changed, 12 insertions, 11 deletions
diff --git a/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.html b/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.html index f61593677..e5340234b 100644 --- a/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.html +++ b/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.html | |||
@@ -30,7 +30,7 @@ | |||
30 | <div class="form-group"> | 30 | <div class="form-group"> |
31 | <label i18n for="instanceDescription">Description</label><my-help helpType="markdownText"></my-help> | 31 | <label i18n for="instanceDescription">Description</label><my-help helpType="markdownText"></my-help> |
32 | <my-markdown-textarea | 32 | <my-markdown-textarea |
33 | id="instanceDescription" formControlName="description" textareaWidth="500px" [previewColumn]="true" | 33 | name="instanceDescription" formControlName="description" textareaWidth="500px" [previewColumn]="true" |
34 | [classes]="{ 'input-error': formErrors['instance.description'] }" | 34 | [classes]="{ 'input-error': formErrors['instance.description'] }" |
35 | ></my-markdown-textarea> | 35 | ></my-markdown-textarea> |
36 | <div *ngIf="formErrors.instance.description" class="form-error">{{ formErrors.instance.description }}</div> | 36 | <div *ngIf="formErrors.instance.description" class="form-error">{{ formErrors.instance.description }}</div> |
@@ -101,7 +101,7 @@ | |||
101 | <div class="form-group"> | 101 | <div class="form-group"> |
102 | <label i18n for="instanceTerms">Terms</label><my-help helpType="markdownText"></my-help> | 102 | <label i18n for="instanceTerms">Terms</label><my-help helpType="markdownText"></my-help> |
103 | <my-markdown-textarea | 103 | <my-markdown-textarea |
104 | id="instanceTerms" formControlName="terms" textareaWidth="500px" [previewColumn]="true" | 104 | name="instanceTerms" formControlName="terms" textareaWidth="500px" [previewColumn]="true" |
105 | [ngClass]="{ 'input-error': formErrors['instance.terms'] }" | 105 | [ngClass]="{ 'input-error': formErrors['instance.terms'] }" |
106 | ></my-markdown-textarea> | 106 | ></my-markdown-textarea> |
107 | <div *ngIf="formErrors.instance.terms" class="form-error">{{ formErrors.instance.terms }}</div> | 107 | <div *ngIf="formErrors.instance.terms" class="form-error">{{ formErrors.instance.terms }}</div> |
@@ -110,7 +110,7 @@ | |||
110 | <div class="form-group"> | 110 | <div class="form-group"> |
111 | <label i18n for="instanceCodeOfConduct">Code of conduct</label><my-help helpType="markdownText"></my-help> | 111 | <label i18n for="instanceCodeOfConduct">Code of conduct</label><my-help helpType="markdownText"></my-help> |
112 | <my-markdown-textarea | 112 | <my-markdown-textarea |
113 | id="instanceCodeOfConduct" formControlName="codeOfConduct" textareaWidth="500px" [previewColumn]="true" | 113 | name="instanceCodeOfConduct" formControlName="codeOfConduct" textareaWidth="500px" [previewColumn]="true" |
114 | [ngClass]="{ 'input-error': formErrors['instance.codeOfConduct'] }" | 114 | [ngClass]="{ 'input-error': formErrors['instance.codeOfConduct'] }" |
115 | ></my-markdown-textarea> | 115 | ></my-markdown-textarea> |
116 | <div *ngIf="formErrors.instance.codeOfConduct" class="form-error">{{ formErrors.instance.codeOfConduct }}</div> | 116 | <div *ngIf="formErrors.instance.codeOfConduct" class="form-error">{{ formErrors.instance.codeOfConduct }}</div> |
@@ -121,7 +121,7 @@ | |||
121 | <div class="label-small-info">Who moderates the instance? What is the policy regarding NSFW videos? Political videos? etc</div> | 121 | <div class="label-small-info">Who moderates the instance? What is the policy regarding NSFW videos? Political videos? etc</div> |
122 | 122 | ||
123 | <my-markdown-textarea | 123 | <my-markdown-textarea |
124 | id="instanceModerationInformation" formControlName="moderationInformation" textareaWidth="500px" [previewColumn]="true" | 124 | name="instanceModerationInformation" formControlName="moderationInformation" textareaWidth="500px" [previewColumn]="true" |
125 | [ngClass]="{ 'input-error': formErrors['instance.moderationInformation'] }" | 125 | [ngClass]="{ 'input-error': formErrors['instance.moderationInformation'] }" |
126 | ></my-markdown-textarea> | 126 | ></my-markdown-textarea> |
127 | <div *ngIf="formErrors.instance.moderationInformation" class="form-error">{{ formErrors.instance.moderationInformation }}</div> | 127 | <div *ngIf="formErrors.instance.moderationInformation" class="form-error">{{ formErrors.instance.moderationInformation }}</div> |
@@ -134,7 +134,7 @@ | |||
134 | <div class="label-small-info">A single person? A non-profit? A company?</div> | 134 | <div class="label-small-info">A single person? A non-profit? A company?</div> |
135 | 135 | ||
136 | <my-markdown-textarea | 136 | <my-markdown-textarea |
137 | id="instanceAdministrator" formControlName="administrator" textareaWidth="500px" textareaHeight="75px" [previewColumn]="true" | 137 | name="instanceAdministrator" formControlName="administrator" textareaWidth="500px" textareaHeight="75px" [previewColumn]="true" |
138 | [classes]="{ 'input-error': formErrors['instance.administrator'] }" | 138 | [classes]="{ 'input-error': formErrors['instance.administrator'] }" |
139 | ></my-markdown-textarea> | 139 | ></my-markdown-textarea> |
140 | 140 | ||
@@ -181,7 +181,7 @@ | |||
181 | <div class="label-small-info">2vCore 2GB RAM/or directly the link to the server you rent etc</div> | 181 | <div class="label-small-info">2vCore 2GB RAM/or directly the link to the server you rent etc</div> |
182 | 182 | ||
183 | <my-markdown-textarea | 183 | <my-markdown-textarea |
184 | id="instanceHardwareInformation" formControlName="hardwareInformation" textareaWidth="500px" textareaHeight="75px" [previewColumn]="true" | 184 | name="instanceHardwareInformation" formControlName="hardwareInformation" textareaWidth="500px" textareaHeight="75px" [previewColumn]="true" |
185 | [classes]="{ 'input-error': formErrors['instance.hardwareInformation'] }" | 185 | [classes]="{ 'input-error': formErrors['instance.hardwareInformation'] }" |
186 | ></my-markdown-textarea> | 186 | ></my-markdown-textarea> |
187 | 187 | ||
@@ -239,7 +239,7 @@ | |||
239 | inputName="signupRequiresEmailVerification" formControlName="requiresEmailVerification" | 239 | inputName="signupRequiresEmailVerification" formControlName="requiresEmailVerification" |
240 | i18n-labelText labelText="Signup requires email verification" | 240 | i18n-labelText labelText="Signup requires email verification" |
241 | ></my-peertube-checkbox> | 241 | ></my-peertube-checkbox> |
242 | 242 | ||
243 | <div [ngClass]="{ 'disabled-checkbox-extra': !isSignupEnabled() }" class="mt-3"> | 243 | <div [ngClass]="{ 'disabled-checkbox-extra': !isSignupEnabled() }" class="mt-3"> |
244 | <label i18n for="signupLimit">Signup limit</label> | 244 | <label i18n for="signupLimit">Signup limit</label> |
245 | <input | 245 | <input |
@@ -372,14 +372,13 @@ | |||
372 | <my-peertube-checkbox | 372 | <my-peertube-checkbox |
373 | inputName="followingsInstanceAutoFollowIndexEnabled" formControlName="enabled" | 373 | inputName="followingsInstanceAutoFollowIndexEnabled" formControlName="enabled" |
374 | i18n-labelText labelText="Automatically follow instances of the public index" | 374 | i18n-labelText labelText="Automatically follow instances of the public index" |
375 | [(ngModel)]="isAutoFollowIndexEnabled" | ||
376 | > | 375 | > |
377 | <ng-container ngProjectAs="description"> | 376 | <ng-container ngProjectAs="description"> |
378 | <span i18n>⚠️ This functionality requires a lot of attention and extra moderation.</span> | 377 | <span i18n>⚠️ This functionality requires a lot of attention and extra moderation.</span> |
379 | </ng-container> | 378 | </ng-container> |
380 | 379 | ||
381 | <ng-container ngProjectAs="extra"> | 380 | <ng-container ngProjectAs="extra"> |
382 | <div [ngClass]="{ 'disabled-checkbox-extra': !isAutoFollowIndexEnabled }"> | 381 | <div [ngClass]="{ 'disabled-checkbox-extra': !isAutoFollowIndexEnabled() }"> |
383 | <label i18n for="followingsInstanceAutoFollowIndexUrl">Index URL</label> | 382 | <label i18n for="followingsInstanceAutoFollowIndexUrl">Index URL</label> |
384 | <input | 383 | <input |
385 | type="text" id="followingsInstanceAutoFollowIndexUrl" | 384 | type="text" id="followingsInstanceAutoFollowIndexUrl" |
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 1bc907b73..c88e81c01 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 | |||
@@ -24,8 +24,6 @@ export class EditCustomConfigComponent extends FormReactive implements OnInit { | |||
24 | languageItems: SelectItem[] = [] | 24 | languageItems: SelectItem[] = [] |
25 | categoryItems: SelectItem[] = [] | 25 | categoryItems: SelectItem[] = [] |
26 | 26 | ||
27 | isAutoFollowIndexEnabled = false | ||
28 | |||
29 | private serverConfig: ServerConfig | 27 | private serverConfig: ServerConfig |
30 | 28 | ||
31 | constructor ( | 29 | constructor ( |
@@ -236,6 +234,10 @@ export class EditCustomConfigComponent extends FormReactive implements OnInit { | |||
236 | return this.form.value['signup']['enabled'] === true | 234 | return this.form.value['signup']['enabled'] === true |
237 | } | 235 | } |
238 | 236 | ||
237 | isAutoFollowIndexEnabled () { | ||
238 | return this.form.value['followings']['instance']['autoFollowIndex']['enabled'] === true | ||
239 | } | ||
240 | |||
239 | async formValidated () { | 241 | async formValidated () { |
240 | this.configService.updateCustomConfig(this.form.getRawValue()) | 242 | this.configService.updateCustomConfig(this.form.getRawValue()) |
241 | .subscribe( | 243 | .subscribe( |