mirror of
https://github.com/bitwarden/server.git
synced 2025-05-22 12:04:27 -05:00
Resolve the failing test
Signed-off-by: Cy Okeke <cokeke@bitwarden.com>
This commit is contained in:
parent
b63055cc6a
commit
d23373b776
@ -255,24 +255,31 @@ public class OrganizationsController : Controller
|
||||
Seats = organization.Seats
|
||||
};
|
||||
|
||||
var freePlan = await _pricingClient.GetPlanOrThrow(model.PlanType.Value);
|
||||
if (organization.PlanType != PlanType.Free && model.PlanType == PlanType.Free && model.Seats > freePlan.PasswordManager.MaxSeats)
|
||||
if (model.PlanType.HasValue)
|
||||
{
|
||||
TempData["Error"] = $"Organizations with more than {freePlan.PasswordManager.MaxSeats} seats cannot be downgraded to the Free plan";
|
||||
return RedirectToAction("Edit", new { id });
|
||||
}
|
||||
var freePlan = await _pricingClient.GetPlanOrThrow(model.PlanType.Value);
|
||||
|
||||
if (organization.PlanType != PlanType.Free && model.PlanType == PlanType.Free && model.MaxCollections > freePlan.PasswordManager.MaxCollections)
|
||||
{
|
||||
TempData["Error"] = $"Organizations with more than {freePlan.PasswordManager.MaxCollections} collections cannot be downgraded to the Free plan. Your organization currently has {organization.MaxCollections} collections.";
|
||||
return RedirectToAction("Edit", new { id });
|
||||
}
|
||||
if (organization.PlanType != PlanType.Free &&
|
||||
model.PlanType.Value == PlanType.Free &&
|
||||
model.Seats.HasValue &&
|
||||
model.Seats.Value > freePlan.PasswordManager.MaxSeats)
|
||||
{
|
||||
TempData["Error"] = $"Organizations with more than {freePlan.PasswordManager.MaxSeats} seats cannot be downgraded to the Free plan";
|
||||
return RedirectToAction("Edit", new { id });
|
||||
}
|
||||
|
||||
if (organization.PlanType != PlanType.Free && model.PlanType == PlanType.Free)
|
||||
{
|
||||
model.MaxStorageGb = null;
|
||||
model.ExpirationDate = null;
|
||||
model.Enabled = true;
|
||||
if (organization.PlanType != PlanType.Free && model.PlanType.Value == PlanType.Free && model.MaxCollections > freePlan.PasswordManager.MaxCollections)
|
||||
{
|
||||
TempData["Error"] = $"Organizations with more than {freePlan.PasswordManager.MaxCollections} collections cannot be downgraded to the Free plan. Your organization currently has {organization.MaxCollections} collections.";
|
||||
return RedirectToAction("Edit", new { id });
|
||||
}
|
||||
|
||||
if (organization.PlanType != PlanType.Free && model.PlanType.Value == PlanType.Free)
|
||||
{
|
||||
model.MaxStorageGb = null;
|
||||
model.ExpirationDate = null;
|
||||
model.Enabled = true;
|
||||
}
|
||||
}
|
||||
|
||||
UpdateOrganization(organization, model);
|
||||
|
Loading…
x
Reference in New Issue
Block a user