Skip to content

Commit

Permalink
fix(FolderManager): Use OCP constant for unlimited space quota value
Browse files Browse the repository at this point in the history
Signed-off-by: provokateurin <[email protected]>
  • Loading branch information
provokateurin committed Oct 8, 2024
1 parent ffcd9c0 commit 5d022bb
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
3 changes: 2 additions & 1 deletion lib/Folder/FolderManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
use OCP\DB\Exception;
use OCP\DB\QueryBuilder\IQueryBuilder;
use OCP\EventDispatcher\IEventDispatcher;
use OCP\Files\FileInfo;
use OCP\Files\IMimeTypeLoader;
use OCP\Files\IRootFolder;
use OCP\IConfig;
Expand Down Expand Up @@ -616,7 +617,7 @@ public function getFoldersFromCircleMemberships(IUser $user, int $rootStorageId
* @throws Exception
*/
public function createFolder(string $mountPoint): int {
$defaultQuota = $this->config->getSystemValueInt('groupfolders.quota.default', -3);
$defaultQuota = $this->config->getSystemValueInt('groupfolders.quota.default', FileInfo::SPACE_UNLIMITED);

$query = $this->connection->getQueryBuilder();

Expand Down
9 changes: 5 additions & 4 deletions tests/Folder/FolderManagerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
use OCA\GroupFolders\Folder\FolderManager;
use OCP\Constants;
use OCP\EventDispatcher\IEventDispatcher;
use OCP\Files\FileInfo;
use OCP\Files\IMimeTypeLoader;
use OCP\IConfig;
use OCP\IDBConnection;
Expand Down Expand Up @@ -40,8 +41,8 @@ protected function setUp(): void {
$this->config = $this->createMock(IConfig::class);
$this->config->expects($this->any())
->method('getSystemValueInt')
->with('groupfolders.quota.default', -3)
->willReturn(-3);
->with('groupfolders.quota.default', FileInfo::SPACE_UNLIMITED)
->willReturn(FileInfo::SPACE_UNLIMITED);
$this->manager = new FolderManager(
Server::get(IDBConnection::class),
$this->groupManager,
Expand Down Expand Up @@ -72,7 +73,7 @@ private function assertHasFolders(array $folders): void {
}

if (!isset($folder['quota'])) {
$folder['quota'] = -3;
$folder['quota'] = FileInfo::SPACE_UNLIMITED;
}

if (!isset($folder['acl'])) {
Expand Down Expand Up @@ -323,7 +324,7 @@ public function testGetFoldersForUserSimple(): void {
'folder_id' => 1,
'mount_point' => 'foo',
'permissions' => 31,
'quota' => -3
'quota' => FileInfo::SPACE_UNLIMITED,
];

$manager->expects($this->once())
Expand Down

0 comments on commit 5d022bb

Please sign in to comment.