model: Use same name for legacy plan across the app.

This commit is contained in:
Aman Agrawal
2023-12-14 07:38:54 +00:00
committed by Tim Abbott
parent c7245d5f3b
commit 34a1be80a4
5 changed files with 19 additions and 4 deletions

View File

@@ -76,7 +76,9 @@ def get_plan_type_string(plan_type: int) -> str:
Realm.PLAN_TYPE_STANDARD_FREE: "Standard free",
Realm.PLAN_TYPE_PLUS: "Plus",
RemoteZulipServer.PLAN_TYPE_SELF_MANAGED: "Self-managed",
RemoteZulipServer.PLAN_TYPE_SELF_MANAGED_LEGACY: "Self-managed (legacy)",
RemoteZulipServer.PLAN_TYPE_SELF_MANAGED_LEGACY: CustomerPlan.name_from_tier(
CustomerPlan.TIER_SELF_HOSTED_LEGACY
),
RemoteZulipServer.PLAN_TYPE_COMMUNITY: "Community",
RemoteZulipServer.PLAN_TYPE_BUSINESS: "Business",
RemoteZulipServer.PLAN_TYPE_ENTERPRISE: "Enterprise",

View File

@@ -2408,6 +2408,9 @@ class BillingSession(ABC):
if plan is not None:
context["plan_name"] = plan.name
context["free_trial"] = plan.is_free_trial()
context["is_server_on_legacy_plan"] = (
plan.tier == CustomerPlan.TIER_SELF_HOSTED_LEGACY
)
self.add_sponsorship_info_to_context(context)
return context

View File

@@ -298,7 +298,7 @@ class CustomerPlan(models.Model):
CustomerPlan.TIER_CLOUD_STANDARD: "Zulip Cloud Standard",
CustomerPlan.TIER_CLOUD_PLUS: "Zulip Cloud Plus",
CustomerPlan.TIER_CLOUD_ENTERPRISE: "Zulip Enterprise",
CustomerPlan.TIER_SELF_HOSTED_LEGACY: "Self-managed",
CustomerPlan.TIER_SELF_HOSTED_LEGACY: "Self-managed (legacy plan)",
CustomerPlan.TIER_SELF_HOSTED_BUSINESS: "Zulip Business",
CustomerPlan.TIER_SELF_HOSTED_COMMUNITY: "Community",
}[tier]

View File

@@ -50,7 +50,7 @@
</a>
{% elif is_server_on_legacy_plan %}
<a href="{{ billing_base_url }}/plans/">
{{ plan_name }}
{{ plan_name.replace(" (legacy plan)", "") -}}
</a>
<i>(legacy plan)</i>
{% else %}

View File

@@ -53,11 +53,21 @@
<label for="sponsored-org-current-plan" class="inline-block label-title">Your plan</label>
<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 free_trial %}
{{ plan_name }} <i>(free trial)</i>
<a href="{{ billing_base_url }}/plans/">
{{ plan_name -}}
</a> <i>(free trial)</i>
{% elif is_server_on_legacy_plan %}
<a href="{{ billing_base_url }}/plans/">
{{ plan_name.replace(" (legacy plan)", "") -}}
</a> <i>(legacy plan)</i>
{% else %}
<a href="{{ billing_base_url }}/plans/">
{{ plan_name }}
</a>
{% endif %}
</div>
</div>