Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Unverified Commit 45a28d91 authored by Akhil's avatar Akhil
Browse files

Remove mail usage patch to quota.php

parent cf57f389
Loading
Loading
Loading
Loading
Loading
+1 −15
Original line number Diff line number Diff line
@@ -22,17 +22,3 @@
 		$ownerDisplayName = '';
 		$owner = \OC::$server->getUserManager()->get($ownerId);
 		if ($owner) {
 No newline at end of file
--- lib/private/Files/Storage/Wrapper/Quota.php	2024-02-28 23:45:03.136041704 +0530
+++ lib/private/Files/Storage/Wrapper/Quota-new.php	2024-02-28 23:49:24.518192286 +0530
@@ -117,7 +117,10 @@
 				return FileInfo::SPACE_NOT_COMPUTED;
 			} else {
 				$free = $this->storage->free_space($path);
-				$quotaFree = max($this->getQuota() - $used, 0);
+				$ownerId = $this->storage->getOwner($path);
+				$mailQuotaUsage = (int) \OC::$server->getConfig()->getUserValue($ownerId, 'ecloud-accounts', 'mailQuotaUsage', 0);
+				$mailQuotaUsage = max($mailQuotaUsage, 0); // to avoid negative mail quota usage value
+				$quotaFree = max($this->getQuota() - $used - $mailQuotaUsage, 0);
 				// if free space is known
 				$free = $free >= 0 ? min($free, $quotaFree) : $quotaFree;
 				return $free;