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 <maxbrunsfeld@gmail.com>
This commit is contained in:
Marshall Bowers
2025-05-20 15:00:10 +00:00
committed by GitHub
co-authored by Max Brunsfeld
parent b7d5e6480a
commit 110195cdae
+3 -7
View File
@@ -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);
}