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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Get the following error printed when running integration tests:

{"Exception":"Error","Message":"Undefined offset: 3 at \/home\/nickv\/Nextcloud\/21\/server\/lib\/private\/legacy\/OC_Helper.php#548","Code":0,"Trace":[{"file":"\/home\/nickv\/Nextcloud\/21\/server\/lib\/private\/legacy\/OC_Helper.php","line":548,"function":"onAll","class":"OC\\Log\\ErrorHandler","type":"::"},{"file":"\/home\/nickv\/Nextcloud\/21\/server\/apps\/provisioning_api\/lib\/Controller\/AUserData.php","line":190,"function":"getStorageInfo","class":"OC_Helper","type":"::"},{"file":"\/home\/nickv\/Nextcloud\/21\/server\/apps\/provisioning_api\/lib\/Controller\/AUserData.php","line":137,"function":"fillStorageInfo","class":"OCA\\Provisioning_API\\Controller\\AUserData","type":"->"},{"file":"\/home\/nickv\/Nextcloud\/21\/server\/apps\/provisioning_api\/lib\/Controller\/UsersController.php","line":394,"function":"getUserData","class":"OCA\\Provisioning_API\\Controller\\AUserData","type":"->"},{"file":"\/home\/nickv\/Nextcloud\/21\/server\/lib\/private\/AppFramework\/Http\/Dispatcher.php","line":218,"function":"getUser","class":"OCA\\Provisioning_API\\Controller\\UsersController","type":"->"},{"file":"\/home\/nickv\/Nextcloud\/21\/server\/lib\/private\/AppFramework\/Http\/Dispatcher.php","line":127,"function":"executeController","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->"},{"file":"\/home\/nickv\/Nextcloud\/21\/server\/lib\/private\/AppFramework\/App.php","line":157,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->"},{"file":"\/home\/nickv\/Nextcloud\/21\/server\/lib\/private\/Route\/Router.php","line":308,"function":"main","class":"OC\\AppFramework\\App","type":"::"},{"file":"\/home\/nickv\/Nextcloud\/21\/server\/ocs\/v1.php","line":88,"function":"match","class":"OC\\Route\\Router","type":"->"},{"file":"\/home\/nickv\/Nextcloud\/21\/server\/ocs\/v2.php","line":24,"args":["\/home\/nickv\/Nextcloud\/21\/server\/ocs\/v1.php"],"function":"require_once"}],"File":"\/home\/nickv\/Nextcloud\/21\/server\/lib\/private\/Log\/ErrorHandler.php","Line":98,"CustomMessage":"--"}


return [
'free' => $free,
Expand All @@ -554,7 +555,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