Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions apps/dav/tests/unit/Connector/Sabre/DirectoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,9 @@ public function testGetQuotaInfoUnlimited() {
->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
}
Expand Down Expand Up @@ -338,6 +341,9 @@ public function testGetQuotaInfoSpecific() {
->method('getMountPoint')
->willReturn($mountPoint);

$mountPoint->method('getMountPoint')
->willReturn('/user/files/mymountpoint');

$this->view->expects($this->once())
->method('getFileInfo')
->willReturn($this->info);
Expand Down
18 changes: 11 additions & 7 deletions apps/files/js/files.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -157,20 +158,23 @@
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!',
{owner: ownerDisplayName}), {type: 'error'}
);
} 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 {
Expand All @@ -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 {
Expand Down
1 change: 1 addition & 0 deletions apps/files/lib/Helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ public static function buildFileStorageStatistics($dir) {
'owner' => $storageInfo['owner'],
'ownerDisplayName' => $storageInfo['ownerDisplayName'],
'mountType' => $storageInfo['mountType'],
'mountPoint' => $storageInfo['mountPoint'],
];
}

Expand Down
8 changes: 7 additions & 1 deletion lib/private/legacy/OC_Helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -545,6 +545,11 @@ public static function getStorageInfo($path, $rootInfo = null) {
if ($owner) {
$ownerDisplayName = $owner->getDisplayName();
}
if (substr_count($mount->getMountPoint(), '/') < 3) {
$mountPoint = '';
} else {
[,,,$mountPoint] = explode('/', $mount->getMountPoint(), 4);
}

return [
'free' => $free,
Expand All @@ -554,7 +559,8 @@ public static function getStorageInfo($path, $rootInfo = null) {
'relative' => $relative,
'owner' => $ownerId,
'ownerDisplayName' => $ownerDisplayName,
'mountType' => $mount->getMountType()
'mountType' => $mount->getMountType(),
'mountPoint' => trim($mountPoint, '/'),
];
}

Expand Down