diff options
author | Florian CUNY <poslovitch@bentobox.world> | 2021-10-26 16:42:10 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-26 16:42:10 +0200 |
commit | 754b6f5f41bdc40aaaeefdb3c351666c305abe20 (patch) | |
tree | d36c8081f3137f1e2c9763879f71d41aa9a3efc1 /client/src/app | |
parent | 615836dbd4f48fc563551446529fa9d3b14dc329 (diff) | |
download | PeerTube-754b6f5f41bdc40aaaeefdb3c351666c305abe20.tar.gz PeerTube-754b6f5f41bdc40aaaeefdb3c351666c305abe20.tar.zst PeerTube-754b6f5f41bdc40aaaeefdb3c351666c305abe20.zip |
Made the video channels limit (per user) server-wide configurable (#4491)
* Made the video channels limit (per user) server-wide configurable
Implements https://github.com/Chocobozzz/PeerTube/issues/3092
Also added a "quota bar" in the account's settings page
* Fixed lint errors
* Another pass at fixing lint errors
* Applied code suggestions
* Removed 'video channels quota'
Diffstat (limited to 'client/src/app')
4 files changed, 42 insertions, 2 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 537e06d4d..318c8e2c2 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 | |||
@@ -272,6 +272,28 @@ | |||
272 | </div> | 272 | </div> |
273 | </div> | 273 | </div> |
274 | 274 | ||
275 | <div class="form-row mt-4"> <!-- video channels grid --> | ||
276 | <div class="form-group col-12 col-lg-4 col-xl-3"> | ||
277 | <div i18n class="inner-form-title">VIDEO CHANNELS</div> | ||
278 | </div> | ||
279 | |||
280 | <div class="form-group form-group-right col-12 col-lg-8 col-xl-9"> | ||
281 | <div class="form-group" formGroupName="videoChannels"> | ||
282 | <label i18n for="videoChannelsMaxPerUser">Max video channels per user</label> | ||
283 | |||
284 | <div class="number-with-unit"> | ||
285 | <input | ||
286 | type="number" min="1" id="videoChannelsMaxPerUser" class="form-control" | ||
287 | formControlName="maxPerUser" [ngClass]="{ 'input-error': formErrors['videoChannels.maxPerUser'] }" | ||
288 | > | ||
289 | <span i18n>{form.value['videoChannels']['maxPerUser'], plural, =1 {channel} other {channels}}</span> | ||
290 | </div> | ||
291 | |||
292 | <div *ngIf="formErrors.videoChannels.maxPerUser" class="form-error">{{ formErrors.videoChannels.maxPerUser }}</div> | ||
293 | </div> | ||
294 | </div> | ||
295 | </div> | ||
296 | |||
275 | <div class="form-row mt-4"> <!-- search grid --> | 297 | <div class="form-row mt-4"> <!-- search grid --> |
276 | <div class="form-group col-12 col-lg-4 col-xl-3"> | 298 | <div class="form-group col-12 col-lg-4 col-xl-3"> |
277 | <div i18n class="inner-form-title">SEARCH</div> | 299 | <div i18n class="inner-form-title">SEARCH</div> |
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 96c67fac7..fdb0a7532 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 | |||
@@ -22,7 +22,8 @@ import { | |||
22 | SERVICES_TWITTER_USERNAME_VALIDATOR, | 22 | SERVICES_TWITTER_USERNAME_VALIDATOR, |
23 | SIGNUP_LIMIT_VALIDATOR, | 23 | SIGNUP_LIMIT_VALIDATOR, |
24 | SIGNUP_MINIMUM_AGE_VALIDATOR, | 24 | SIGNUP_MINIMUM_AGE_VALIDATOR, |
25 | TRANSCODING_THREADS_VALIDATOR | 25 | TRANSCODING_THREADS_VALIDATOR, |
26 | MAX_VIDEO_CHANNELS_PER_USER_VALIDATOR | ||
26 | } from '@app/shared/form-validators/custom-config-validators' | 27 | } from '@app/shared/form-validators/custom-config-validators' |
27 | import { USER_VIDEO_QUOTA_DAILY_VALIDATOR, USER_VIDEO_QUOTA_VALIDATOR } from '@app/shared/form-validators/user-validators' | 28 | import { USER_VIDEO_QUOTA_DAILY_VALIDATOR, USER_VIDEO_QUOTA_VALIDATOR } from '@app/shared/form-validators/user-validators' |
28 | import { FormReactive, FormValidatorService } from '@app/shared/shared-forms' | 29 | import { FormReactive, FormValidatorService } from '@app/shared/shared-forms' |
@@ -151,6 +152,9 @@ export class EditCustomConfigComponent extends FormReactive implements OnInit { | |||
151 | videoQuota: USER_VIDEO_QUOTA_VALIDATOR, | 152 | videoQuota: USER_VIDEO_QUOTA_VALIDATOR, |
152 | videoQuotaDaily: USER_VIDEO_QUOTA_DAILY_VALIDATOR | 153 | videoQuotaDaily: USER_VIDEO_QUOTA_DAILY_VALIDATOR |
153 | }, | 154 | }, |
155 | videoChannels: { | ||
156 | maxPerUser: MAX_VIDEO_CHANNELS_PER_USER_VALIDATOR | ||
157 | }, | ||
154 | transcoding: { | 158 | transcoding: { |
155 | enabled: null, | 159 | enabled: null, |
156 | threads: TRANSCODING_THREADS_VALIDATOR, | 160 | threads: TRANSCODING_THREADS_VALIDATOR, |
diff --git a/client/src/app/shared/form-validators/custom-config-validators.ts b/client/src/app/shared/form-validators/custom-config-validators.ts index fbf423d08..ba8512e95 100644 --- a/client/src/app/shared/form-validators/custom-config-validators.ts +++ b/client/src/app/shared/form-validators/custom-config-validators.ts | |||
@@ -98,6 +98,15 @@ export const MAX_USER_LIVES_VALIDATOR: BuildFormValidator = { | |||
98 | } | 98 | } |
99 | } | 99 | } |
100 | 100 | ||
101 | export const MAX_VIDEO_CHANNELS_PER_USER_VALIDATOR: BuildFormValidator = { | ||
102 | VALIDATORS: [ Validators.required, Validators.min(1), Validators.pattern('[0-9]+') ], | ||
103 | MESSAGES: { | ||
104 | required: $localize`Max video channels per user is required.`, | ||
105 | min: $localize`Max video channels per user must be greater or equal to 1.`, | ||
106 | pattern: $localize`Max video channels per user must be a number.` | ||
107 | } | ||
108 | } | ||
109 | |||
101 | export const CONCURRENCY_VALIDATOR: BuildFormValidator = { | 110 | export const CONCURRENCY_VALIDATOR: BuildFormValidator = { |
102 | VALIDATORS: [ Validators.required, Validators.min(1) ], | 111 | VALIDATORS: [ Validators.required, Validators.min(1) ], |
103 | MESSAGES: { | 112 | MESSAGES: { |
diff --git a/client/src/app/shared/shared-main/shared-main.module.ts b/client/src/app/shared/shared-main/shared-main.module.ts index 80d0a84f3..93989780d 100644 --- a/client/src/app/shared/shared-main/shared-main.module.ts +++ b/client/src/app/shared/shared-main/shared-main.module.ts | |||
@@ -43,7 +43,12 @@ import { | |||
43 | } from './misc' | 43 | } from './misc' |
44 | import { PluginPlaceholderComponent } from './plugins' | 44 | import { PluginPlaceholderComponent } from './plugins' |
45 | import { ActorRedirectGuard } from './router' | 45 | import { ActorRedirectGuard } from './router' |
46 | import { UserHistoryService, UserNotificationsComponent, UserNotificationService, UserQuotaComponent } from './users' | 46 | import { |
47 | UserHistoryService, | ||
48 | UserNotificationsComponent, | ||
49 | UserNotificationService, | ||
50 | UserQuotaComponent | ||
51 | } from './users' | ||
47 | import { RedundancyService, VideoImportService, VideoOwnershipService, VideoService } from './video' | 52 | import { RedundancyService, VideoImportService, VideoOwnershipService, VideoService } from './video' |
48 | import { VideoCaptionService } from './video-caption' | 53 | import { VideoCaptionService } from './video-caption' |
49 | import { VideoChannelService } from './video-channel' | 54 | import { VideoChannelService } from './video-channel' |