Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

populate_billing_realms: Don't create plan for sponsored remote realm.

Aman Agrawal35b644c564fd
diff --git a/zilencer/management/commands/populate_billing_realms.py b/zilencer/management/commands/populate_billing_realms.py
index dd4e91335a0..693abe127c1 100644
--- a/zilencer/management/commands/populate_billing_realms.py
+++ b/zilencer/management/commands/populate_billing_realms.py
@@ -364,7 +364,8 @@ def populate_realm(customer_profile: CustomerProfile) -> Optional[Realm]:
# Remote realm billing data on their local server is irrelevant.
return realm
- if customer_profile.sponsorship_pending:
+ if customer_profile.sponsorship_pending or customer_profile.is_sponsored:
+ # plan_type is already set correctly above for sponsored realms.
customer = Customer.objects.create(
realm=realm,
sponsorship_pending=customer_profile.sponsorship_pending,
@@ -512,7 +513,8 @@ def populate_remote_realms(customer_profile: CustomerProfile) -> Dict[str, str]:
billing_session.do_change_plan_type(
tier=customer_profile.tier, is_sponsored=customer_profile.is_sponsored
)
- create_plan_for_customer(customer, customer_profile)
+ if not customer_profile.is_sponsored:
+ create_plan_for_customer(customer, customer_profile)
if customer_profile.sponsorship_pending:
billing_session.update_customer_sponsorship_status(True)