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.

support: Clean up template variables for remote server support.

Lauryn Menardc2a76ccb3e76
diff --git a/analytics/views/support.py b/analytics/views/support.py
index 97320a7aab1..c56d886151c 100644
--- a/analytics/views/support.py
+++ b/analytics/views/support.py
@@ -486,6 +486,7 @@ def remote_servers_support(
context["get_discount"] = get_customer_discount_for_support_view
context["get_plan_type_name"] = get_plan_type_string
context["get_org_type_display_name"] = get_org_type_display_name
+ context["SPONSORED_PLAN_TYPE"] = RemoteZulipServer.PLAN_TYPE_COMMUNITY
return render(
request,
diff --git a/corporate/lib/support.py b/corporate/lib/support.py
index d41e8c10cb1..02a9a6db08b 100644
--- a/corporate/lib/support.py
+++ b/corporate/lib/support.py
@@ -20,6 +20,7 @@ class PlanData:
licenses: Optional[int] = None
licenses_used: Optional[int] = None
is_legacy_plan: bool = False
+ has_fixed_price: bool = False
warning: Optional[str] = None
@@ -65,5 +66,6 @@ def get_current_plan_data_for_support_view(billing_session: BillingSession) -> P
plan_data.is_legacy_plan = (
plan_data.current_plan.tier == CustomerPlan.TIER_SELF_HOSTED_LEGACY
)
+ plan_data.has_fixed_price = plan_data.current_plan.fixed_price is not None
return plan_data
diff --git a/templates/analytics/remote_server_support.html b/templates/analytics/remote_server_support.html
index d03b42c4c73..7dc643327f1 100644
--- a/templates/analytics/remote_server_support.html
+++ b/templates/analytics/remote_server_support.html
@@ -47,12 +47,12 @@
<b>Max monthly messages</b>: {{ remote_server_to_max_monthly_messages[remote_server.id] }}<br />
<b>Plan type</b>: {{ get_plan_type_name(remote_server.plan_type) }}<br />
<b>Has remote realm(s)</b>: {{ remote_realms[remote_server.id] != [] }}
- {% if remote_server.plan_type == 100 %}
+ {% if remote_server.plan_type == SPONSORED_PLAN_TYPE %}
<h4>On 100% sponsored Zulip Community plan.</h4>
{% endif %}
</div>
- {% if remote_server.plan_type != 100 %}
+ {% if remote_server.plan_type != SPONSORED_PLAN_TYPE %}
<form method="POST" class="remote-server-form">
<b>Sponsorship pending</b>:<br />
{{ csrf_input }}
@@ -76,12 +76,12 @@
</form>
{% endif %}
- {% if remote_server.plan_type != 100 %}
+ {% if remote_server.plan_type != SPONSORED_PLAN_TYPE %}
<form method="POST" class="remote-server-form">
<b>Discount</b>:<br />
{{ csrf_input }}
<input type="hidden" name="remote_server_id" value="{{ remote_server.id }}" />
- {% if plan_data[remote_server.id].current_plan and plan_data[remote_server.id].current_plan.fixed_price %}
+ {% if plan_data[remote_server.id].has_fixed_price %}
<input type="number" name="discount" value="{{ get_discount(plan_data[remote_server.id].customer) }}" disabled />
<button type="submit" class="btn btn-default support-submit-button" disabled>Update</button>
{% else %}