mirror of
https://github.com/zulip/zulip.git
synced 2026-07-06 21:18:58 +08:00
billing: Require no realm plans when approving server sponsorship.
This commit is contained in:
parent
511cc4d8f7
commit
219df72d07
@ -3800,6 +3800,16 @@ class RemoteServerBillingSession(BillingSession):
|
||||
# Sponsorship approval is only a support admin action.
|
||||
assert self.support_session
|
||||
|
||||
# Check no realm has a current plan, which would mean
|
||||
# approving this sponsorship would violate our invariant that
|
||||
# we never have active plans for both a remote realm and its
|
||||
# remote server.
|
||||
realm_plans = CustomerPlan.objects.filter(
|
||||
customer__remote_realm__server=self.remote_server
|
||||
).exclude(status=CustomerPlan.ENDED)
|
||||
if realm_plans.exists():
|
||||
return "Cannot approve server-level Community plan while some realms active plans."
|
||||
|
||||
customer = self.get_customer()
|
||||
if customer is not None:
|
||||
error_message = self.check_customer_not_on_paid_plan(customer)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user