浏览代码

add mount point to quota warning message

makes it more clear to the user what the quota applies to

Signed-off-by: Robin Appelman <robin@icewind.nl>
tags/v21.0.0beta1
Robin Appelman 3 年前
父节点
当前提交
0dfdf3ee99
没有帐户链接到提交者的电子邮件
共有 3 个文件被更改,包括 15 次插入8 次删除
  1. 11
    7
      apps/files/js/files.js
  2. 1
    0
      apps/files/lib/Helper.php
  3. 3
    1
      lib/private/legacy/OC_Helper.php

+ 11
- 7
apps/files/js/files.js 查看文件

$('#upload.button').attr('data-original-title', response.data.maxHumanFilesize); $('#upload.button').attr('data-original-title', response.data.maxHumanFilesize);
$('#usedSpacePercent').val(response.data.usedSpacePercent); $('#usedSpacePercent').val(response.data.usedSpacePercent);
$('#usedSpacePercent').data('mount-type', response.data.mountType); $('#usedSpacePercent').data('mount-type', response.data.mountType);
$('#usedSpacePercent').data('mount-point', response.data.mountPoint);
$('#owner').val(response.data.owner); $('#owner').val(response.data.owner);
$('#ownerDisplayName').val(response.data.ownerDisplayName); $('#ownerDisplayName').val(response.data.ownerDisplayName);
Files.displayStorageWarnings(); Files.displayStorageWarnings();
var usedSpacePercent = $('#usedSpacePercent').val(), var usedSpacePercent = $('#usedSpacePercent').val(),
owner = $('#owner').val(), owner = $('#owner').val(),
ownerDisplayName = $('#ownerDisplayName').val(), ownerDisplayName = $('#ownerDisplayName').val(),
mountType = $('#usedSpacePercent').data('mount-type');
mountType = $('#usedSpacePercent').data('mount-type'),
mountPoint = $('#usedSpacePercent').data('mount-point');
if (usedSpacePercent > 98) { if (usedSpacePercent > 98) {
if (owner !== OC.getCurrentUser().uid) { if (owner !== OC.getCurrentUser().uid) {
OC.Notification.show(t('files', 'Storage of {owner} is full, files can not be updated or synced anymore!', OC.Notification.show(t('files', 'Storage of {owner} is full, files can not be updated or synced anymore!',
); );
} else if (mountType === 'group') { } else if (mountType === 'group') {
OC.Notification.show(t('files', OC.Notification.show(t('files',
'This group folder is full, files can not be updated or synced anymore!'),
'Group folder "{mountPoint}" is full, files can not be updated or synced anymore!',
{mountPoint: mountPoint}),
{type: 'error'} {type: 'error'}
); );
} else if (mountType === 'external') { } else if (mountType === 'external') {
OC.Notification.show(t('files', OC.Notification.show(t('files',
'This external storage is full, files can not be updated or synced anymore!'),
'External storage "{mountPoint}" is full, files can not be updated or synced anymore!',
{mountPoint: mountPoint}),
{type : 'error'} {type : 'error'}
); );
} else { } else {
); );
} else if (mountType === 'group') { } else if (mountType === 'group') {
OC.Notification.show(t('files', OC.Notification.show(t('files',
'This group folder is almost full ({usedSpacePercent}%).',
{usedSpacePercent: usedSpacePercent}),
'Group folder "{mountPoint}" is almost full ({usedSpacePercent}%).',
{mountPoint: mountPoint, usedSpacePercent: usedSpacePercent}),
{type : 'error'} {type : 'error'}
); );
} else if (mountType === 'external') { } else if (mountType === 'external') {
OC.Notification.show(t('files', OC.Notification.show(t('files',
'This external storage is almost full ({usedSpacePercent}%).',
{usedSpacePercent: usedSpacePercent}),
'External storage "{mountPoint}" is almost full ({usedSpacePercent}%).',
{mountPoint: mountPoint, usedSpacePercent: usedSpacePercent}),
{type : 'error'} {type : 'error'}
); );
} else { } else {

+ 1
- 0
apps/files/lib/Helper.php 查看文件

'owner' => $storageInfo['owner'], 'owner' => $storageInfo['owner'],
'ownerDisplayName' => $storageInfo['ownerDisplayName'], 'ownerDisplayName' => $storageInfo['ownerDisplayName'],
'mountType' => $storageInfo['mountType'], 'mountType' => $storageInfo['mountType'],
'mountPoint' => $storageInfo['mountPoint'],
]; ];
} }



+ 3
- 1
lib/private/legacy/OC_Helper.php 查看文件

if ($owner) { if ($owner) {
$ownerDisplayName = $owner->getDisplayName(); $ownerDisplayName = $owner->getDisplayName();
} }
[,,,$mountPoint] = explode('/', $mount->getMountPoint(), 4);


return [ return [
'free' => $free, 'free' => $free,
'relative' => $relative, 'relative' => $relative,
'owner' => $ownerId, 'owner' => $ownerId,
'ownerDisplayName' => $ownerDisplayName, 'ownerDisplayName' => $ownerDisplayName,
'mountType' => $mount->getMountType()
'mountType' => $mount->getMountType(),
'mountPoint' => trim($mountPoint, '/'),
]; ];
} }



正在加载...
取消
保存