From d59151025366d11e3baa7fd16c2d987ba5a227a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20Molakvo=C3=A6?= Date: Wed, 4 Oct 2023 08:44:57 +0200 Subject: [PATCH] fix(files): legacy humanFileSize tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: John Molakvoæ --- apps/files/js/file-upload.js | 10 +++++----- apps/files/js/filelist.js | 8 ++++---- apps/files/js/files.js | 6 +++--- apps/files/js/filesummary.js | 4 ++-- apps/files/js/mainfileinfodetailview.js | 2 +- 5 files changed, 15 insertions(+), 15 deletions(-) diff --git a/apps/files/js/file-upload.js b/apps/files/js/file-upload.js index 61bd53eb35f3e..0301c1fe6acbe 100644 --- a/apps/files/js/file-upload.js +++ b/apps/files/js/file-upload.js @@ -1063,8 +1063,8 @@ OC.Uploader.prototype = _.extend({ data.textStatus = 'notenoughspace'; data.errorThrown = t('files', 'Not enough free space, you are uploading {size1} but only {size2} is left', { - 'size1': OC.Util.humanFileSize(selection.totalBytes), - 'size2': OC.Util.humanFileSize(freeSpace) + 'size1': OC.Util.humanFileSize(selection.totalBytes, false, false), + 'size2': OC.Util.humanFileSize(freeSpace, false, false) }); } @@ -1302,9 +1302,9 @@ OC.Uploader.prototype = _.extend({ } self._setProgressBarText(h, h, t('files', '{loadedSize} of {totalSize} ({bitrate})' , { - loadedSize: OC.Util.humanFileSize(data.loaded), - totalSize: OC.Util.humanFileSize(total), - bitrate: OC.Util.humanFileSize(smoothBitrate / 8) + '/s' + loadedSize: OC.Util.humanFileSize(data.loaded, false, false), + totalSize: OC.Util.humanFileSize(total, false, false), + bitrate: OC.Util.humanFileSize(smoothBitrate / 8, false, false) + '/s' })); self._setProgressBarValue(progress); self.trigger('progressall', e, data); diff --git a/apps/files/js/filelist.js b/apps/files/js/filelist.js index cfc21e909c066..7f5eade84ffaf 100644 --- a/apps/files/js/filelist.js +++ b/apps/files/js/filelist.js @@ -1798,7 +1798,7 @@ // size column if (typeof(fileData.size) !== 'undefined' && fileData.size >= 0) { - simpleSize = OC.Util.humanFileSize(parseInt(fileData.size, 10), true); + simpleSize = OC.Util.humanFileSize(parseInt(fileData.size, 10), true, false); // rgb(118, 118, 118) / #767676 // min. color contrast for normal text on white background according to WCAG AA sizeColor = Math.round(118-Math.pow((fileData.size/(1024*1024)), 2)); @@ -2609,7 +2609,7 @@ var oldSize = oldFile.data('size'); var newSize = oldSize + newFile.data('size'); oldFile.data('size', newSize); - oldFile.find('td.filesize').text(OC.Util.humanFileSize(newSize)); + oldFile.find('td.filesize').text(OC.Util.humanFileSize(newSize, false, false)); self.remove(fileName); } @@ -2752,7 +2752,7 @@ var oldSize = oldFile.data('size'); var newSize = oldSize + newFile.data('size'); oldFile.data('size', newSize); - oldFile.find('td.filesize').text(OC.Util.humanFileSize(newSize)); + oldFile.find('td.filesize').text(OC.Util.humanFileSize(newSize, false, false)); } self.reload(); }) @@ -3463,7 +3463,7 @@ } else { this.$el.find('.selectedActions').removeClass('hidden'); - this.$el.find('.column-size a>span:first').text(OC.Util.humanFileSize(summary.totalSize)); + this.$el.find('.column-size a>span:first').text(OC.Util.humanFileSize(summary.totalSize, false, false)); var directoryInfo = n('files', '%n folder', '%n folders', summary.totalDirs); var fileInfo = n('files', '%n file', '%n files', summary.totalFiles); diff --git a/apps/files/js/files.js b/apps/files/js/files.js index 486e437a8aa38..88a762ca9c739 100644 --- a/apps/files/js/files.js +++ b/apps/files/js/files.js @@ -101,8 +101,8 @@ && response.data.total !== undefined && response.data.used !== undefined && response.data.usedSpacePercent !== undefined) { - var humanUsed = OC.Util.humanFileSize(response.data.used, true); - var humanTotal = OC.Util.humanFileSize(response.data.total, true); + var humanUsed = OC.Util.humanFileSize(response.data.used, true, false); + var humanTotal = OC.Util.humanFileSize(response.data.total, true, false); if (response.data.quota > 0) { $('#quota').attr('title', t('files', '{used}%', {used: Math.round(response.data.usedSpacePercent)})); $('#quota progress').val(response.data.usedSpacePercent); @@ -425,7 +425,7 @@ var createDragShadow = function(event) { .attr('data-file', elem.name) .attr('data-origin', elem.origin); newtr.append($('').text(elem.name).css('background-size', 32)); - newtr.append($('').text(OC.Util.humanFileSize(elem.size))); + newtr.append($('').text(OC.Util.humanFileSize(elem.size, false, false))); tbody.append(newtr); if (elem.type === 'dir') { newtr.find('td.filename') diff --git a/apps/files/js/filesummary.js b/apps/files/js/filesummary.js index 00f13249ff327..0e9b191510a1c 100644 --- a/apps/files/js/filesummary.js +++ b/apps/files/js/filesummary.js @@ -226,7 +226,7 @@ $dirInfo.html(n('files', '%n folder', '%n folders', this.summary.totalDirs)); $fileInfo.html(n('files', '%n file', '%n files', this.summary.totalFiles)); $hiddenInfo.html(' (' + n('files', 'including %n hidden', 'including %n hidden', this.summary.totalHidden) + ')'); - var fileSize = this.summary.sumIsPending ? t('files', 'Pending') : OC.Util.humanFileSize(this.summary.totalSize); + var fileSize = this.summary.sumIsPending ? t('files', 'Pending') : OC.Util.humanFileSize(this.summary.totalSize, false, false); this.$el.find('.filesize').html(fileSize); // Show only what's necessary (may be hidden) @@ -263,7 +263,7 @@ // don't show the filesize column, if filesize is NaN (e.g. in trashbin) var fileSize = ''; if (!isNaN(summary.totalSize)) { - fileSize = summary.sumIsPending ? t('files', 'Pending') : OC.Util.humanFileSize(summary.totalSize); + fileSize = summary.sumIsPending ? t('files', 'Pending') : OC.Util.humanFileSize(summary.totalSize, false, false); fileSize = '' + fileSize + ''; } diff --git a/apps/files/js/mainfileinfodetailview.js b/apps/files/js/mainfileinfodetailview.js index b5093e5c251b3..45988a60a0223 100644 --- a/apps/files/js/mainfileinfodetailview.js +++ b/apps/files/js/mainfileinfodetailview.js @@ -156,7 +156,7 @@ path: this.model.get('path'), hasSize: this.model.has('size'), sizeLabel: t('files', 'Size'), - size: OC.Util.humanFileSize(this.model.get('size'), true), + size: OC.Util.humanFileSize(this.model.get('size'), true, false), altSize: n('files', '%n byte', '%n bytes', this.model.get('size')), dateLabel: t('files', 'Modified'), altDate: OC.Util.formatDate(this.model.get('mtime')),