Fix default quota display value in user row

When selecting default quota in the dropdown, the actual numeric value
or "Unlimited" will be displayed instead of "0 B". This matches whatever
is displayed after refreshing the page.

In the case where the default quota is unlimited, for which the server
returns -3 instead of "none", the frontend now also shows "Unlimited"
instead of "0 B".

Signed-off-by: Vincent Petry <vincent@nextcloud.com>
This commit is contained in:
Vincent Petry 2020-10-27 11:10:06 +01:00
parent 4ea4918b62
commit 2230585765
No known key found for this signature in database
GPG Key ID: E055D6A4D513575C
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)
},