diff options
author | Roeland Jago Douma <rullzer@users.noreply.github.com> | 2020-11-16 21:29:10 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-16 21:29:10 +0300 |
commit | 5aca22f825992a07e7aae5a437a9395ef4203ed8 (patch) | |
tree | 1d096820b7e9ed997be02f51145d39e0cbd67334 | |
parent | 93b9cab7b2ad67098c4b81bb89f11dbb8c84acde (diff) | |
parent | e29eb55f8b709c420689571964dae8e36b18fa37 (diff) |
Merge pull request #24078 from nextcloud/backport/23168/stable18
[stable18] add mount point to quota warning message
-rw-r--r-- | apps/dav/tests/unit/Connector/Sabre/DirectoryTest.php | 6 | ||||
-rw-r--r-- | apps/files/js/files.js | 18 | ||||
-rw-r--r-- | apps/files/lib/Helper.php | 1 | ||||
-rw-r--r-- | lib/private/legacy/helper.php | 8 |
4 files changed, 25 insertions, 8 deletions
diff --git a/apps/dav/tests/unit/Connector/Sabre/DirectoryTest.php b/apps/dav/tests/unit/Connector/Sabre/DirectoryTest.php index 641b03e0781..890c3392cd0 100644 --- a/apps/dav/tests/unit/Connector/Sabre/DirectoryTest.php +++ b/apps/dav/tests/unit/Connector/Sabre/DirectoryTest.php @@ -299,6 +299,9 @@ class DirectoryTest extends \Test\TestCase { ->method('getMountPoint') ->willReturn($mountPoint); + $mountPoint->method('getMountPoint') + ->willReturn('/user/files/mymountpoint'); + $dir = new Directory($this->view, $this->info); $this->assertEquals([200, -3], $dir->getQuotaInfo()); //200 used, unlimited } @@ -334,6 +337,9 @@ class DirectoryTest extends \Test\TestCase { ->method('getMountPoint') ->willReturn($mountPoint); + $mountPoint->method('getMountPoint') + ->willReturn('/user/files/mymountpoint'); + $dir = new Directory($this->view, $this->info); $this->assertEquals([200, 800], $dir->getQuotaInfo()); //200 used, 800 free } diff --git a/apps/files/js/files.js b/apps/files/js/files.js index 977e642948c..3a08dda1cf9 100644 --- a/apps/files/js/files.js +++ b/apps/files/js/files.js @@ -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(); @@ -155,7 +156,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!', @@ -163,12 +165,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 { @@ -190,14 +194,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 { diff --git a/apps/files/lib/Helper.php b/apps/files/lib/Helper.php index 46c97db94b9..294dd7e2a96 100644 --- a/apps/files/lib/Helper.php +++ b/apps/files/lib/Helper.php @@ -63,6 +63,7 @@ class Helper { 'owner' => $storageInfo['owner'], 'ownerDisplayName' => $storageInfo['ownerDisplayName'], 'mountType' => $storageInfo['mountType'], + 'mountPoint' => $storageInfo['mountPoint'], ]; } diff --git a/lib/private/legacy/helper.php b/lib/private/legacy/helper.php index 0f7b2d1b3af..ae933421bce 100644 --- a/lib/private/legacy/helper.php +++ b/lib/private/legacy/helper.php @@ -544,6 +544,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, @@ -553,7 +558,8 @@ class OC_Helper { 'relative' => $relative, 'owner' => $ownerId, 'ownerDisplayName' => $ownerDisplayName, - 'mountType' => $mount->getMountType() + 'mountType' => $mount->getMountType(), + 'mountPoint' => trim($mountPoint, '/'), ]; } |