support: Clean up template variables for remote server support.

This commit is contained in:
Lauryn Menard
2023-12-11 17:09:36 +01:00
committed by Tim Abbott
parent f1ffb1f56e
commit c2a76ccb3e
3 changed files with 7 additions and 4 deletions

View File

@@ -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,

View File

@@ -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

View File

@@ -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 %}