Skip to content

Commit

Permalink
fix(files): legacy humanFileSize tests
Browse files Browse the repository at this point in the history
Signed-off-by: John Molakvoæ <[email protected]>
  • Loading branch information
skjnldsv committed Oct 4, 2023
1 parent d79e26b commit d591510
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 15 deletions.
10 changes: 5 additions & 5 deletions apps/files/js/file-upload.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
});
}

Expand Down Expand Up @@ -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);
Expand Down
8 changes: 4 additions & 4 deletions apps/files/js/filelist.js
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down Expand Up @@ -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);
}
Expand Down Expand Up @@ -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();
})
Expand Down Expand Up @@ -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);
Expand Down
6 changes: 3 additions & 3 deletions apps/files/js/files.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -425,7 +425,7 @@ var createDragShadow = function(event) {
.attr('data-file', elem.name)
.attr('data-origin', elem.origin);
newtr.append($('<td class="filename"></td>').text(elem.name).css('background-size', 32));
newtr.append($('<td class="size"></td>').text(OC.Util.humanFileSize(elem.size)));
newtr.append($('<td class="size"></td>').text(OC.Util.humanFileSize(elem.size, false, false)));
tbody.append(newtr);
if (elem.type === 'dir') {
newtr.find('td.filename')
Expand Down
4 changes: 2 additions & 2 deletions apps/files/js/filesummary.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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 = '<td class="filesize">' + fileSize + '</td>';
}

Expand Down
2 changes: 1 addition & 1 deletion apps/files/js/mainfileinfodetailview.js
Original file line number Diff line number Diff line change
Expand Up @@ -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')),
Expand Down

0 comments on commit d591510

Please sign in to comment.