diff options
author | Vincent Petry <vincent@nextcloud.com> | 2020-10-27 11:10:06 +0100 |
---|---|---|
committer | Vincent Petry <vincent@nextcloud.com> | 2020-10-27 13:00:43 +0100 |
commit | 66ce56e42486c5658c28454441daeca0e19df931 (patch) | |
tree | 54744520849a71f292aa8fd449c431cdeeb906ef /apps/settings/src | |
parent | 25f347a49a4ccbe8903de05c9e56d5d0940faf92 (diff) | |
download | nextcloud-server-66ce56e42486c5658c28454441daeca0e19df931.tar.gz nextcloud-server-66ce56e42486c5658c28454441daeca0e19df931.zip |
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>
Diffstat (limited to 'apps/settings/src')
-rw-r--r-- | apps/settings/src/components/UserList/UserRowSimple.vue | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/apps/settings/src/components/UserList/UserRowSimple.vue b/apps/settings/src/components/UserList/UserRowSimple.vue index ebfb19465fb..d1b4e6cbb2b 100644 --- a/apps/settings/src/components/UserList/UserRowSimple.vue +++ b/apps/settings/src/components/UserList/UserRowSimple.vue @@ -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) }, |