]> source.dussan.org Git - nextcloud-server.git/commitdiff
show better quota warning for group folders and external storage
authorRobin Appelman <robin@icewind.nl>
Tue, 25 Aug 2020 14:05:16 +0000 (16:05 +0200)
committerRobin Appelman <robin@icewind.nl>
Tue, 25 Aug 2020 14:05:16 +0000 (16:05 +0200)
instead of showing the generic 'Your storage is full' message, better explain that it's the group folder/external storage that is full

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 28e4c5f575a0ab1bc28591cc43cd9b4aa340b62a..cdc1c70ffc58f9f4add0bd5a276c3d56e3e0f7bd 100644 (file)
@@ -72,6 +72,7 @@
                                $('#free_space').val(response.data.freeSpace);
                                $('#upload.button').attr('data-original-title', response.data.maxHumanFilesize);
                                $('#usedSpacePercent').val(response.data.usedSpacePercent);
+                               $('#usedSpacePercent').data('mount-type', response.data.mountType);
                                $('#owner').val(response.data.owner);
                                $('#ownerDisplayName').val(response.data.ownerDisplayName);
                                Files.displayStorageWarnings();
 
                        var usedSpacePercent = $('#usedSpacePercent').val(),
                                owner = $('#owner').val(),
-                               ownerDisplayName = $('#ownerDisplayName').val();
+                               ownerDisplayName = $('#ownerDisplayName').val(),
+                               mountType = $('#usedSpacePercent').data('mount-type');
                        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'}
                                        );
-                                       return;
+                               } else if (mountType === 'group') {
+                                       OC.Notification.show(t('files',
+                                               'This group folder is full, files can not be updated or synced anymore!'),
+                                               {type: 'error'}
+                                       );
+                               } else if (mountType === 'external') {
+                                       OC.Notification.show(t('files',
+                                               'This external storage is full, files can not be updated or synced anymore!'),
+                                               {type : 'error'}
+                                       );
+                               } else {
+                                       OC.Notification.show(t('files',
+                                               'Your storage is full, files can not be updated or synced anymore!'),
+                                               {type: 'error'}
+                                       );
                                }
-                               OC.Notification.show(t('files',
-                                       'Your storage is full, files can not be updated or synced anymore!'),
-                                       {type : 'error'}
-                               );
-                               return;
-                       }
-                       if (usedSpacePercent > 90) {
+                       } else if (usedSpacePercent > 90) {
                                if (owner !== OC.getCurrentUser().uid) {
                                        OC.Notification.show(t('files', 'Storage of {owner} is almost full ({usedSpacePercent}%)',
                                                {
                                                        type: 'error'
                                                }
                                        );
-                                       return;
+                               } else if (mountType === 'group') {
+                                       OC.Notification.show(t('files',
+                                               'This group folder is almost full ({usedSpacePercent}%)',
+                                               {usedSpacePercent: usedSpacePercent}),
+                                               {type : 'error'}
+                                       );
+                               } else if (mountType === 'external') {
+                                       OC.Notification.show(t('files',
+                                               'This external storage is almost full ({usedSpacePercent}%)',
+                                               {usedSpacePercent: usedSpacePercent}),
+                                               {type : 'error'}
+                                       );
+                               } else {
+                                       OC.Notification.show(t('files', 'Your storage is almost full ({usedSpacePercent}%)',
+                                               {usedSpacePercent: usedSpacePercent}),
+                                               {type : 'error'}
+                                       );
                                }
-                               OC.Notification.show(t('files', 'Your storage is almost full ({usedSpacePercent}%)',
-                                       {usedSpacePercent: usedSpacePercent}),
-                                       {type : 'error'}
-                               );
                        }
                },
 
index 3431fb2ffc7422d1acc8bd0a31d48697f07d3009..1f728565ca641f3addb9187e18c4e0c24ffce62c 100644 (file)
@@ -63,6 +63,7 @@ class Helper {
                        'usedSpacePercent'  => (int)$storageInfo['relative'],
                        'owner' => $storageInfo['owner'],
                        'ownerDisplayName' => $storageInfo['ownerDisplayName'],
+                       'mountType' => $storageInfo['mountType'],
                ];
        }
 
index 61bdaeb88a9e68d64ac64cba39effa18e82466b5..77f0d922564201005a2ec9e9d3802ad9491030a7 100644 (file)
@@ -495,7 +495,8 @@ class OC_Helper {
                        $used = 0;
                }
                $quota = \OCP\Files\FileInfo::SPACE_UNLIMITED;
-               $storage = $rootInfo->getStorage();
+               $mount = $rootInfo->getMountPoint();
+               $storage = $mount->getStorage();
                $sourceStorage = $storage;
                if ($storage->instanceOfStorage('\OCA\Files_Sharing\SharedStorage')) {
                        $includeExtStorage = false;
@@ -553,6 +554,7 @@ class OC_Helper {
                        'relative' => $relative,
                        'owner' => $ownerId,
                        'ownerDisplayName' => $ownerDisplayName,
+                       'mountType' => $mount->getMountType()
                ];
        }