]> source.dussan.org Git - nextcloud-server.git/commitdiff
add mount point to quota warning message
authorRobin Appelman <robin@icewind.nl>
Thu, 17 Sep 2020 14:19:41 +0000 (16:19 +0200)
committerbackportbot[bot] <backportbot[bot]@users.noreply.github.com>
Sun, 4 Oct 2020 11:05:24 +0000 (11:05 +0000)
makes it more clear to the user what the quota applies to

Signed-off-by: Robin Appelman <robin@icewind.nl>
apps/files/js/files.js
apps/files/lib/Helper.php
lib/private/legacy/OC_Helper.php

index 5481ece055c6aea52f18ac5b19285b59018325dc..6dbd87c1e2eedc90b037d436afad9864352a2bc2 100644 (file)
@@ -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();
                        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!',
                                        );
                                } 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 {
                                        );
                                } 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 {
index 1f728565ca641f3addb9187e18c4e0c24ffce62c..2d5a3e2f26eab58a959688ffb4d57cfeb1947247 100644 (file)
@@ -64,6 +64,7 @@ class Helper {
                        'owner' => $storageInfo['owner'],
                        'ownerDisplayName' => $storageInfo['ownerDisplayName'],
                        'mountType' => $storageInfo['mountType'],
+                       'mountPoint' => $storageInfo['mountPoint'],
                ];
        }
 
index 77f0d922564201005a2ec9e9d3802ad9491030a7..8a38ca3b0d294de57bb194d763233a516dc5ceb0 100644 (file)
@@ -545,6 +545,7 @@ class OC_Helper {
                if ($owner) {
                        $ownerDisplayName = $owner->getDisplayName();
                }
+               [,,,$mountPoint] = explode('/', $mount->getMountPoint(), 4);
 
                return [
                        'free' => $free,
@@ -554,7 +555,8 @@ class OC_Helper {
                        'relative' => $relative,
                        'owner' => $ownerId,
                        'ownerDisplayName' => $ownerDisplayName,
-                       'mountType' => $mount->getMountType()
+                       'mountType' => $mount->getMountType(),
+                       'mountPoint' => trim($mountPoint, '/'),
                ];
        }