diff options
Diffstat (limited to 'client/src/app/core')
-rw-r--r-- | client/src/app/core/users/user.model.ts | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/client/src/app/core/users/user.model.ts b/client/src/app/core/users/user.model.ts index 7d03e1c40..5e1fb1c8d 100644 --- a/client/src/app/core/users/user.model.ts +++ b/client/src/app/core/users/user.model.ts | |||
@@ -133,4 +133,30 @@ export class User implements UserServerModel { | |||
133 | isUploadDisabled () { | 133 | isUploadDisabled () { |
134 | return this.videoQuota === 0 || this.videoQuotaDaily === 0 | 134 | return this.videoQuota === 0 || this.videoQuotaDaily === 0 |
135 | } | 135 | } |
136 | |||
137 | isAutoBlocked () { | ||
138 | return this.role === UserRole.USER && this.adminFlags !== UserAdminFlag.BYPASS_VIDEO_AUTO_BLACKLIST | ||
139 | } | ||
140 | |||
141 | hasNoQuotaLeft () { | ||
142 | // unlimited videoQuota | ||
143 | if (this.videoQuota === -1) return false | ||
144 | |||
145 | // no more videoQuota | ||
146 | if (!this.videoQuotaUsed) return true | ||
147 | |||
148 | // videoQuota left lower than 10% | ||
149 | return this.videoQuotaUsed > this.videoQuota * 0.9 | ||
150 | } | ||
151 | |||
152 | hasNoQuotaLeftDaily () { | ||
153 | // unlimited videoQuotaDaily | ||
154 | if (this.videoQuotaDaily === -1) return false | ||
155 | |||
156 | // no more videoQuotaDaily | ||
157 | if (!this.videoQuotaUsedDaily) return true | ||
158 | |||
159 | // videoQuotaDaily left lower than 10% | ||
160 | return this.videoQuotaUsedDaily > this.videoQuotaDaily * 0.9 | ||
161 | } | ||
136 | } | 162 | } |