Merge pull request #23168 from nextcloud/backport/22913/stable19
[stable19] add mount point to quota warning message
This commit is contained in:
commit
38b060628b
|
@ -303,6 +303,9 @@ class DirectoryTest extends \Test\TestCase {
|
|||
->method('getFileInfo')
|
||||
->willReturn($this->info);
|
||||
|
||||
$mountPoint->method('getMountPoint')
|
||||
->willReturn('/user/files/mymountpoint');
|
||||
|
||||
$dir = new Directory($this->view, $this->info);
|
||||
$this->assertEquals([200, -3], $dir->getQuotaInfo()); //200 used, unlimited
|
||||
}
|
||||
|
@ -338,6 +341,9 @@ class DirectoryTest extends \Test\TestCase {
|
|||
->method('getMountPoint')
|
||||
->willReturn($mountPoint);
|
||||
|
||||
$mountPoint->method('getMountPoint')
|
||||
->willReturn('/user/files/mymountpoint');
|
||||
|
||||
$this->view->expects($this->once())
|
||||
->method('getFileInfo')
|
||||
->willReturn($this->info);
|
||||
|
|
|
@ -73,6 +73,7 @@
|
|||
$('#upload.button').attr('data-original-title', response.data.maxHumanFilesize);
|
||||
$('#usedSpacePercent').val(response.data.usedSpacePercent);
|
||||
$('#usedSpacePercent').data('mount-type', response.data.mountType);
|
||||
$('#usedSpacePercent').data('mount-point', response.data.mountPoint);
|
||||
$('#owner').val(response.data.owner);
|
||||
$('#ownerDisplayName').val(response.data.ownerDisplayName);
|
||||
Files.displayStorageWarnings();
|
||||
|
@ -157,7 +158,8 @@
|
|||
var usedSpacePercent = $('#usedSpacePercent').val(),
|
||||
owner = $('#owner').val(),
|
||||
ownerDisplayName = $('#ownerDisplayName').val(),
|
||||
mountType = $('#usedSpacePercent').data('mount-type');
|
||||
mountType = $('#usedSpacePercent').data('mount-type'),
|
||||
mountPoint = $('#usedSpacePercent').data('mount-point');
|
||||
if (usedSpacePercent > 98) {
|
||||
if (owner !== OC.getCurrentUser().uid) {
|
||||
OC.Notification.show(t('files', 'Storage of {owner} is full, files can not be updated or synced anymore!',
|
||||
|
@ -165,12 +167,14 @@
|
|||
);
|
||||
} else if (mountType === 'group') {
|
||||
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'}
|
||||
);
|
||||
} else if (mountType === 'external') {
|
||||
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'}
|
||||
);
|
||||
} else {
|
||||
|
@ -192,14 +196,14 @@
|
|||
);
|
||||
} else if (mountType === 'group') {
|
||||
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'}
|
||||
);
|
||||
} else if (mountType === 'external') {
|
||||
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'}
|
||||
);
|
||||
} else {
|
||||
|
|
|
@ -64,6 +64,7 @@ class Helper {
|
|||
'owner' => $storageInfo['owner'],
|
||||
'ownerDisplayName' => $storageInfo['ownerDisplayName'],
|
||||
'mountType' => $storageInfo['mountType'],
|
||||
'mountPoint' => $storageInfo['mountPoint'],
|
||||
];
|
||||
}
|
||||
|
||||
|
|
|
@ -545,6 +545,11 @@ class OC_Helper {
|
|||
if ($owner) {
|
||||
$ownerDisplayName = $owner->getDisplayName();
|
||||
}
|
||||
if (substr_count($mount->getMountPoint(), '/') < 3) {
|
||||
$mountPoint = '';
|
||||
} else {
|
||||
[,,,$mountPoint] = explode('/', $mount->getMountPoint(), 4);
|
||||
}
|
||||
|
||||
return [
|
||||
'free' => $free,
|
||||
|
@ -554,7 +559,8 @@ class OC_Helper {
|
|||
'relative' => $relative,
|
||||
'owner' => $ownerId,
|
||||
'ownerDisplayName' => $ownerDisplayName,
|
||||
'mountType' => $mount->getMountType()
|
||||
'mountType' => $mount->getMountType(),
|
||||
'mountPoint' => trim($mountPoint, '/'),
|
||||
];
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue