diff options
author | Ms Kimsible <1877318+kimsible@users.noreply.github.com> | 2021-08-25 11:38:10 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-08-25 11:38:10 +0200 |
commit | 4e1592daa41f81667f914f37d36795e8c6c046c3 (patch) | |
tree | 8bed3af237b6d5d4da08af989c3824a168e6f3b6 /client/src/app/core | |
parent | 644800ef5588e08da2a8227f6d72751d3dca85db (diff) | |
download | PeerTube-4e1592daa41f81667f914f37d36795e8c6c046c3.tar.gz PeerTube-4e1592daa41f81667f914f37d36795e8c6c046c3.tar.zst PeerTube-4e1592daa41f81667f914f37d36795e8c6c046c3.zip |
Alert user for low quota and video auto-block on upload page (#4336)
* Replace wording of instance contact
* Add contact-us button to no-quota alert on upload page
* Add alert for accounts with auto-blocked videos on upload page
* Add alert for accounts without enough quota + refacto on upload page
* Using ng-container and ng-template
* Add alert for daily quota
* Add hook filter for upload page alert messages
* Add instance name as subtitle in contact modal
* Fix eslint max-len on string
* Fix missing word in quota left daily message - upload page
Co-authored-by: Kimsible <kimsible@users.noreply.github.com>
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 | } |