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.

corporate: Add and use CustomerPlan.COMPLIMENTARY_PLAN_TIERS.

Lauryn Menarda6ca968a292b
diff --git a/corporate/lib/stripe.py b/corporate/lib/stripe.py
index c119610f81b..71a02108146 100644
--- a/corporate/lib/stripe.py
+++ b/corporate/lib/stripe.py
@@ -3415,9 +3415,7 @@ class BillingSession(ABC):
plan = get_current_plan_by_customer(customer)
if plan is not None:
context["plan_name"] = plan.name
- context["is_server_on_legacy_plan"] = (
- plan.tier == CustomerPlan.TIER_SELF_HOSTED_LEGACY
- )
+ context["complimentary_access"] = plan.is_complimentary_access_plan()
self.add_org_type_data_to_sponsorship_context(context)
return context
diff --git a/corporate/models.py b/corporate/models.py
index 4d36c10ee8e..00e7567d251 100644
--- a/corporate/models.py
+++ b/corporate/models.py
@@ -414,6 +414,8 @@ class CustomerPlan(AbstractCustomerPlan):
TIER_SELF_HOSTED_ENTERPRISE,
]
+ COMPLIMENTARY_PLAN_TIERS = [TIER_SELF_HOSTED_LEGACY]
+
ACTIVE = 1
DOWNGRADE_AT_END_OF_CYCLE = 2
FREE_TRIAL = 3
@@ -490,6 +492,9 @@ class CustomerPlan(AbstractCustomerPlan):
def is_free_trial(self) -> bool:
return self.status == CustomerPlan.FREE_TRIAL
+ def is_complimentary_access_plan(self) -> bool:
+ return self.tier in self.COMPLIMENTARY_PLAN_TIERS
+
def is_a_paid_plan(self) -> bool:
return self.tier in self.PAID_PLAN_TIERS
diff --git a/templates/corporate/billing/sponsorship.html b/templates/corporate/billing/sponsorship.html
index 6d76fb2c920..f04f1c9515d 100644
--- a/templates/corporate/billing/sponsorship.html
+++ b/templates/corporate/billing/sponsorship.html
@@ -54,8 +54,8 @@
<div id="sponsored-org-current-plan" class="not-editable-realm-field">
{% if is_sponsored %}
<a href="{{ billing_base_url }}/plans/">{{ sponsorship_plan_name }}</a>
- {% elif is_server_on_legacy_plan %}
- <a href="{{ billing_base_url }}/plans/">{{ plan_name.replace(" (legacy plan)", "") }}</a> <i>(legacy plan)</i>
+ {% elif complimentary_access %}
+ <a href="{{ billing_base_url }}/plans/">Zulip Basic</a> <i>(complimentary access)</i>
{% else %}
<a href="{{ billing_base_url }}/plans/">{{ plan_name }}</a>
{% endif %}