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.

plans: Show special text for legacy orgs scheduled for upgrade.

Aman Agrawal34730203b3fa
diff --git a/corporate/views/portico.py b/corporate/views/portico.py
index 0cbf13e5b9a..4af8baac328 100644
--- a/corporate/views/portico.py
+++ b/corporate/views/portico.py
@@ -74,6 +74,8 @@ class PlansPageContext:
is_new_customer: bool = False
on_free_tier: bool = False
customer_plan: Optional[CustomerPlan] = None
+ is_legacy_server_with_scheduled_upgrade: bool = False
+ legacy_server_new_plan: Optional[CustomerPlan] = None
billing_base_url: str = ""
@@ -183,6 +185,16 @@ def remote_server_plans_page(
CustomerPlan.TIER_SELF_HOSTED_BASE,
)
context.on_free_trial = is_customer_on_free_trial(context.customer_plan)
+ context.is_legacy_server_with_scheduled_upgrade = (
+ context.customer_plan.status == CustomerPlan.SWITCH_PLAN_TIER_AT_PLAN_END
+ )
+ if context.is_legacy_server_with_scheduled_upgrade:
+ assert context.customer_plan.end_date is not None
+ context.legacy_server_new_plan = CustomerPlan.objects.get(
+ customer=customer,
+ billing_cycle_anchor=context.customer_plan.end_date,
+ status=CustomerPlan.NEVER_STARTED,
+ )
context.is_new_customer = (
not context.on_free_tier and context.customer_plan is None and not context.is_sponsored
diff --git a/templates/corporate/pricing_model.html b/templates/corporate/pricing_model.html
index 86de684bfc8..1078f7d490c 100644
--- a/templates/corporate/pricing_model.html
+++ b/templates/corporate/pricing_model.html
@@ -188,7 +188,11 @@
</div>
<div class="bottom">
<div class="text-content">
- {% if is_self_hosted_realm and on_free_tier and not sponsorship_pending %}
+ {% if is_legacy_server_with_scheduled_upgrade and legacy_server_new_plan.tier == legacy_server_new_plan.TIER_SELF_HOSTED_BUSINESS %}
+ <a href="{{ billing_base_url }}/billing/" class="button current-plan-button">
+ Upgrade is scheduled
+ </a>
+ {% elif is_self_hosted_realm and on_free_tier and not sponsorship_pending %}
<a href="{{ billing_base_url }}/sponsorship/" class="button current-plan-button request-sponsorship">
Request sponsorship
</a>
@@ -247,7 +251,11 @@
</div>
<div class="bottom">
<div class="text-content">
- {% if is_self_hosted_realm and customer_plan and customer_plan.tier == customer_plan.TIER_SELF_HOSTED_ENTERPRISE %}
+ {% if is_legacy_server_with_scheduled_upgrade and legacy_server_new_plan.tier == legacy_server_new_plan.TIER_SELF_HOSTED_ENTERPRISE %}
+ <a href="{{ billing_base_url }}/billing/" class="button current-plan-button">
+ Upgrade is scheduled
+ </a>
+ {% elif is_self_hosted_realm and customer_plan and customer_plan.tier == customer_plan.TIER_SELF_HOSTED_ENTERPRISE %}
<a href='{{ billing_base_url }}/billing' class="button current-plan-button" type="button">
<i class="icon current-plan-icon"></i>
Current plan