From 173e9bf6c11397f1c92cd211867e834635e8a8ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Calvi=C3=B1o=20S=C3=A1nchez?= Date: Wed, 10 Aug 2022 11:22:50 +0200 Subject: [PATCH] Use total available space rather than quota when updating the display MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The initial quota display uses the total available space rather than the quota. Moreover, the relative usage is based on the total space rather than the quota. Due to this now the total available space is also used when updating the quota display. Signed-off-by: Daniel Calviño Sánchez --- apps/files/js/files.js | 5 +++-- apps/files/lib/Helper.php | 1 + 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/apps/files/js/files.js b/apps/files/js/files.js index 0fb0165e89f..1aff9f5332d 100644 --- a/apps/files/js/files.js +++ b/apps/files/js/files.js @@ -98,14 +98,15 @@ } if (response.data !== undefined && response.data.quota !== undefined + && response.data.total !== undefined && response.data.used !== undefined && response.data.usedSpacePercent !== undefined) { var humanUsed = OC.Util.humanFileSize(response.data.used, true); - var humanQuota = OC.Util.humanFileSize(response.data.quota, true); + var humanTotal = OC.Util.humanFileSize(response.data.total, true); if (response.data.quota > 0) { $('#quota').attr('data-original-title', Math.floor(response.data.used/response.data.quota*1000)/10 + '%'); $('#quota progress').val(response.data.usedSpacePercent); - $('#quotatext').html(t('files', '{used} of {quota} used', {used: humanUsed, quota: humanQuota})); + $('#quotatext').html(t('files', '{used} of {quota} used', {used: humanUsed, quota: humanTotal})); } else { $('#quotatext').html(t('files', '{used} used', {used: humanUsed})); } diff --git a/apps/files/lib/Helper.php b/apps/files/lib/Helper.php index 18fea3aa2a1..22744e5940f 100644 --- a/apps/files/lib/Helper.php +++ b/apps/files/lib/Helper.php @@ -58,6 +58,7 @@ class Helper { 'maxHumanFilesize' => $maxHumanFileSize, 'freeSpace' => $storageInfo['free'], 'quota' => $storageInfo['quota'], + 'total' => $storageInfo['total'], 'used' => $storageInfo['used'], 'usedSpacePercent' => (int)$storageInfo['relative'], 'owner' => $storageInfo['owner'],