From 110195cdaef8df49107bf65718170fa206177f3b Mon Sep 17 00:00:00 2001 From: Marshall Bowers Date: Tue, 20 May 2025 11:00:10 -0400 Subject: [PATCH] collab: Only create a Zed Free subscription if there is no other active subscription (#31023) This PR makes it so we only create a Zed Free subscription if there is no other active subscription, rather than just having another Zed Free subscription. Release Notes: - N/A Co-authored-by: Max Brunsfeld --- crates/collab/src/stripe_billing.rs | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/crates/collab/src/stripe_billing.rs b/crates/collab/src/stripe_billing.rs index 1af341261d88945d4bf58b629fb81833c4b78aa6..13a1c7587751a25c1c00f2b6e9b3b010c6a4e576 100644 --- a/crates/collab/src/stripe_billing.rs +++ b/crates/collab/src/stripe_billing.rs @@ -320,19 +320,15 @@ impl StripeBilling { ) .await?; - let existing_zed_free_subscription = + let existing_active_subscription = existing_subscriptions .data .into_iter() .find(|subscription| { subscription.status == SubscriptionStatus::Active - && subscription.items.data.iter().any(|item| { - item.price - .as_ref() - .map_or(false, |price| price.id == zed_free_price_id) - }) + || subscription.status == SubscriptionStatus::Trialing }); - if let Some(subscription) = existing_zed_free_subscription { + if let Some(subscription) = existing_active_subscription { return Ok(subscription); }