From 0dcaadb6687c231d803978b4ef6d4d75c61ea629 Mon Sep 17 00:00:00 2001 From: mdecimus Date: Sun, 20 Jul 2025 15:51:27 +0200 Subject: [PATCH] Fix tenant quota update API --- .../directory/src/backend/internal/manage.rs | 32 +++++++++++-------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/crates/directory/src/backend/internal/manage.rs b/crates/directory/src/backend/internal/manage.rs index 721ad388..538988a3 100644 --- a/crates/directory/src/backend/internal/manage.rs +++ b/crates/directory/src/backend/internal/manage.rs @@ -394,13 +394,15 @@ impl ManageDirectory for Store { let mut principal_quotas = Vec::new(); for (idx, quota) in quotas.into_iter().take(Type::MAX_ID + 2).enumerate() { - if idx != 0 { - principal_quotas.push(PrincipalQuota { - quota, - typ: Type::from_u8((idx - 1) as u8), - }); - } else if quota != 0 { - principal_create.quota = Some(quota); + if quota != 0 { + if idx != 0 { + principal_quotas.push(PrincipalQuota { + quota, + typ: Type::from_u8((idx - 1) as u8), + }); + } else { + principal_create.quota = Some(quota); + } } } @@ -1209,13 +1211,15 @@ impl ManageDirectory for Store { let mut principal_quotas = Vec::new(); for (idx, quota) in quotas.into_iter().enumerate() { - if idx != 0 { - principal_quotas.push(PrincipalQuota { - quota, - typ: Type::from_u8((idx - 1) as u8), - }); - } else if quota != 0 { - new_quota = Some(quota); + if quota != 0 { + if idx != 0 { + principal_quotas.push(PrincipalQuota { + quota, + typ: Type::from_u8((idx - 1) as u8), + }); + } else { + new_quota = Some(quota); + } } }