aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/shared
diff options
context:
space:
mode:
authorFelix Ableitner <me@nutomic.com>2018-08-28 02:01:35 -0500
committerChocobozzz <me@florianbigard.com>2018-08-28 09:01:35 +0200
commitbee0abffff73804d816b90c7fd599e0a51c09d61 (patch)
treefae6d58637f9c63a3800090277f8e130b43442dd /client/src/app/shared
parentc907c2fa3fd7c0a741117a0204d0ebca675124bd (diff)
downloadPeerTube-bee0abffff73804d816b90c7fd599e0a51c09d61.tar.gz
PeerTube-bee0abffff73804d816b90c7fd599e0a51c09d61.tar.zst
PeerTube-bee0abffff73804d816b90c7fd599e0a51c09d61.zip
Implement daily upload limit (#956)
* Implement daily upload limit (ref #652) * remove duplicate code * review fixes * fix tests? * whitespace fixes, finish leftover todo * fix tests * added some new tests * use different config value for tests * remove todo
Diffstat (limited to 'client/src/app/shared')
-rw-r--r--client/src/app/shared/forms/form-validators/user-validators.service.ts8
-rw-r--r--client/src/app/shared/users/user.model.ts3
2 files changed, 11 insertions, 0 deletions
diff --git a/client/src/app/shared/forms/form-validators/user-validators.service.ts b/client/src/app/shared/forms/form-validators/user-validators.service.ts
index ec9566ef3..424553d74 100644
--- a/client/src/app/shared/forms/form-validators/user-validators.service.ts
+++ b/client/src/app/shared/forms/form-validators/user-validators.service.ts
@@ -9,6 +9,7 @@ export class UserValidatorsService {
9 readonly USER_EMAIL: BuildFormValidator 9 readonly USER_EMAIL: BuildFormValidator
10 readonly USER_PASSWORD: BuildFormValidator 10 readonly USER_PASSWORD: BuildFormValidator
11 readonly USER_VIDEO_QUOTA: BuildFormValidator 11 readonly USER_VIDEO_QUOTA: BuildFormValidator
12 readonly USER_VIDEO_QUOTA_DAILY: BuildFormValidator
12 readonly USER_ROLE: BuildFormValidator 13 readonly USER_ROLE: BuildFormValidator
13 readonly USER_DISPLAY_NAME: BuildFormValidator 14 readonly USER_DISPLAY_NAME: BuildFormValidator
14 readonly USER_DESCRIPTION: BuildFormValidator 15 readonly USER_DESCRIPTION: BuildFormValidator
@@ -61,6 +62,13 @@ export class UserValidatorsService {
61 'min': this.i18n('Quota must be greater than -1.') 62 'min': this.i18n('Quota must be greater than -1.')
62 } 63 }
63 } 64 }
65 this.USER_VIDEO_QUOTA_DAILY = {
66 VALIDATORS: [ Validators.required, Validators.min(-1) ],
67 MESSAGES: {
68 'required': this.i18n('Daily upload limit is required.'),
69 'min': this.i18n('Daily upload limit must be greater than -1.')
70 }
71 }
64 72
65 this.USER_ROLE = { 73 this.USER_ROLE = {
66 VALIDATORS: [ Validators.required ], 74 VALIDATORS: [ Validators.required ],
diff --git a/client/src/app/shared/users/user.model.ts b/client/src/app/shared/users/user.model.ts
index 2748001d0..877f1bf3a 100644
--- a/client/src/app/shared/users/user.model.ts
+++ b/client/src/app/shared/users/user.model.ts
@@ -16,6 +16,7 @@ export type UserConstructorHash = {
16 email: string, 16 email: string,
17 role: UserRole, 17 role: UserRole,
18 videoQuota?: number, 18 videoQuota?: number,
19 videoQuotaDaily?: number,
19 nsfwPolicy?: NSFWPolicyType, 20 nsfwPolicy?: NSFWPolicyType,
20 autoPlayVideo?: boolean, 21 autoPlayVideo?: boolean,
21 createdAt?: Date, 22 createdAt?: Date,
@@ -33,6 +34,7 @@ export class User implements UserServerModel {
33 nsfwPolicy: NSFWPolicyType 34 nsfwPolicy: NSFWPolicyType
34 autoPlayVideo: boolean 35 autoPlayVideo: boolean
35 videoQuota: number 36 videoQuota: number
37 videoQuotaDaily: number
36 account: Account 38 account: Account
37 videoChannels: VideoChannel[] 39 videoChannels: VideoChannel[]
38 createdAt: Date 40 createdAt: Date
@@ -48,6 +50,7 @@ export class User implements UserServerModel {
48 50
49 this.videoChannels = hash.videoChannels 51 this.videoChannels = hash.videoChannels
50 this.videoQuota = hash.videoQuota 52 this.videoQuota = hash.videoQuota
53 this.videoQuotaDaily = hash.videoQuotaDaily
51 this.nsfwPolicy = hash.nsfwPolicy 54 this.nsfwPolicy = hash.nsfwPolicy
52 this.autoPlayVideo = hash.autoPlayVideo 55 this.autoPlayVideo = hash.autoPlayVideo
53 this.createdAt = hash.createdAt 56 this.createdAt = hash.createdAt