Skip to content

Commit

Permalink
add mount point to quota warning message
Browse files Browse the repository at this point in the history
makes it more clear to the user what the quota applies to

Signed-off-by: Robin Appelman <[email protected]>
  • Loading branch information
icewind1991 authored and rullzer committed Oct 4, 2020
1 parent 12da69d commit 0dfdf3e
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 8 deletions.
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);

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

0 comments on commit 0dfdf3e

Please sign in to comment.