Merge pull request #23726 from nextcloud/backport/23711/stable20

[stable20] Fix default quota display value in user row
This commit is contained in:
Roeland Jago Douma 2020-10-27 20:07:29 +01:00 committed by GitHub
commit 86c66c29a9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 20 additions and 19 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -154,11 +154,21 @@ export default {
return getCurrentUser().uid !== this.user.id || this.settings.isAdmin
},
userQuota() {
if (this.user.quota.quota === 'none') {
return t('settings', 'Unlimited')
let quota = this.user.quota.quota
if (quota === 'default') {
quota = this.settings.defaultQuota
if (quota !== 'none') {
// convert to numeric value to match what the server would usually return
quota = OC.Util.computerFileSize(quota)
}
if (this.user.quota.quota >= 0) {
return OC.Util.humanFileSize(this.user.quota.quota)
}
// when the default quota is unlimited, the server returns -3 here, map it to "none"
if (quota === 'none' || quota === -3) {
return t('settings', 'Unlimited')
} else if (quota >= 0) {
return OC.Util.humanFileSize(quota)
}
return OC.Util.humanFileSize(0)
},