From 2a7e15b9cb8893806775a38b09ca999068509df9 Mon Sep 17 00:00:00 2001 From: Nikolay Rechkin Date: Fri, 9 Sep 2022 11:54:17 +0300 Subject: [PATCH] Quota: fix quota setting --- products/ASC.People/Server/Api/UserController.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/products/ASC.People/Server/Api/UserController.cs b/products/ASC.People/Server/Api/UserController.cs index a68f0741ae..93f41cdcb0 100644 --- a/products/ASC.People/Server/Api/UserController.cs +++ b/products/ASC.People/Server/Api/UserController.cs @@ -1107,7 +1107,13 @@ public class UserController : PeopleControllerBase { if (inDto.Quota != Constants.UserNoQuota) { - var usedSpace = await _globalSpace.GetUserUsedSpaceAsync(user.Id); + var usedSpace = Math.Max(0, + _userManager.FindUserQuotaRows( + _tenantManager.GetCurrentTenant().Id, + user.Id.ToString() + ) + .Where(r => !string.IsNullOrEmpty(r.Tag)).Sum(r => r.Counter)); + var quotaBytes = ByteConverter.ConvertSizeToBytes(inDto.Quota); var tenanSpaceQuota = _tenantExtra.GetTenantQuota().MaxTotalSize;