From b829f72c179ed7d942b49a78e1890422de5cda98 Mon Sep 17 00:00:00 2001 From: Marshall Bowers Date: Wed, 21 May 2025 18:00:19 -0400 Subject: [PATCH] collab: Prefer the plan on the subscription over the one on the usage (#31127) This PR makes it so we always prefer the plan on the subscription. The plan stored on the subscription usage is informational only. Release Notes: - N/A --- crates/collab/src/api/billing.rs | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/crates/collab/src/api/billing.rs b/crates/collab/src/api/billing.rs index 0c39383ef1..3840f5c909 100644 --- a/crates/collab/src/api/billing.rs +++ b/crates/collab/src/api/billing.rs @@ -1293,15 +1293,10 @@ async fn get_current_usage( .get_subscription_usage_for_period(user.id, period_start_at, period_end_at) .await?; - let plan = usage - .as_ref() - .map(|usage| usage.plan.into()) - .unwrap_or_else(|| { - subscription - .kind - .map(Into::into) - .unwrap_or(zed_llm_client::Plan::ZedFree) - }); + let plan = subscription + .kind + .map(Into::into) + .unwrap_or(zed_llm_client::Plan::ZedFree); let model_requests_limit = match plan.model_requests_limit() { zed_llm_client::UsageLimit::Limited(limit) => {