From 79542cf70c4a77af20feb8a9fad2a045931ae9f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Calvi=C3=B1o=20S=C3=A1nchez?= Date: Thu, 23 Jun 2022 13:24:04 +0200 Subject: [PATCH 1/3] Fix quota text shown escaped MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit "t()" escapes and sanitizes the returned text by default, so strings like "<" are converted to "<". However, the "jQuery.text()" parameter does not need to be escaped, as "<" is shown literally as "<" rather than "<". Now "jQuery.html()" is used instead, which "unescapes" the given text and sets it as a new text node (as the text in the parameter does not contain markup for elements, only text). Signed-off-by: Daniel Calviño Sánchez --- apps/files/js/files.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/files/js/files.js b/apps/files/js/files.js index 8645719f82b..5f00ce2cb22 100644 --- a/apps/files/js/files.js +++ b/apps/files/js/files.js @@ -105,9 +105,9 @@ 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').text(t('files', '{used} of {quota} used', {used: humanUsed, quota: humanQuota})); + $('#quotatext').html(t('files', '{used} of {quota} used', {used: humanUsed, quota: humanQuota})); } else { - $('#quotatext').text(t('files', '{used} used', {used: humanUsed})); + $('#quotatext').html(t('files', '{used} used', {used: humanUsed})); } if (response.data.usedSpacePercent > 80) { $('#quota progress').addClass('warn'); From edbda9c15b26a86cd5b394bfe5ae59117aa61214 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Calvi=C3=B1o=20S=C3=A1nchez?= Date: Thu, 23 Jun 2022 13:24:35 +0200 Subject: [PATCH 2/3] Fix quota text not updated when no quota is set MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The JavaScript code that updates the quota text expects the element to have "quotatext" as id. Signed-off-by: Daniel Calviño Sánchez --- apps/files/templates/appnavigation.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/files/templates/appnavigation.php b/apps/files/templates/appnavigation.php index 0bfdc6f0b54..9aea68fef99 100644 --- a/apps/files/templates/appnavigation.php +++ b/apps/files/templates/appnavigation.php @@ -12,7 +12,7 @@
  • -

    t('%s used', [$_['usage']])); ?>

    +

    t('%s used', [$_['usage']])); ?>

  • From 14f3029fe5203fefe1e295da675c7618daa4cf1c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Calvi=C3=B1o=20S=C3=A1nchez?= Date: Thu, 23 Jun 2022 13:24:58 +0200 Subject: [PATCH 3/3] Fix quota text not updated after copying or moving a file MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Note that the quota may change too when files are moved if the file is moved, for example, to or from a folder shared by other user. Besides the quota the storage statistics are also updated, similar to what is done when a file is deleted. Signed-off-by: Daniel Calviño Sánchez --- apps/files/js/filelist.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/apps/files/js/filelist.js b/apps/files/js/filelist.js index 69322273a11..3530cb66301 100644 --- a/apps/files/js/filelist.js +++ b/apps/files/js/filelist.js @@ -2630,7 +2630,10 @@ self.showFileBusyState($tr, false); }); }; - return this.reportOperationProgress(fileNames, moveFileFunction, callback); + return this.reportOperationProgress(fileNames, moveFileFunction, callback).then(function() { + self.updateStorageStatistics(); + self.updateStorageQuotas(); + }); }, _reflect: function (promise){ @@ -2810,7 +2813,10 @@ } }); }; - return this.reportOperationProgress(fileNames, copyFileFunction, callback); + return this.reportOperationProgress(fileNames, copyFileFunction, callback).then(function() { + self.updateStorageStatistics(); + self.updateStorageQuotas(); + }); }, /**