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: Pass remote_support_view boolean in context for views.

Lauryn Menard84dddbd496ed
diff --git a/corporate/views/support.py b/corporate/views/support.py
index 4b4fa726fa8..9c8d1e09365 100644
--- a/corporate/views/support.py
+++ b/corporate/views/support.py
@@ -671,6 +671,7 @@ def support(
context["ORGANIZATION_TYPES"] = sorted(
Realm.ORG_TYPES.values(), key=lambda d: d["display_order"]
)
+ context["remote_support_view"] = False
return render(request, "corporate/support/support.html", context=context)
@@ -957,6 +958,7 @@ def remote_servers_support(
)
context["get_remote_realm_billing_user_emails"] = get_remote_realm_billing_user_emails_as_string
context["SPONSORED_PLAN_TYPE"] = RemoteZulipServer.PLAN_TYPE_COMMUNITY
+ context["remote_support_view"] = True
return render(
request,
diff --git a/templates/corporate/support/current_plan_forms_support.html b/templates/corporate/support/current_plan_forms_support.html
index d937e6dbe8c..353f2ddf04f 100644
--- a/templates/corporate/support/current_plan_forms_support.html
+++ b/templates/corporate/support/current_plan_forms_support.html
@@ -9,7 +9,7 @@
<button type="submit" class="support-submit-button">Update</button>
</form>
-{% if current_plan.status == current_plan.ACTIVE %}
+{% if current_plan.status == current_plan.ACTIVE and remote_support_view %}
<form method="POST" class="support-form">
<b>Plan end date</b><br />
{{ csrf_input }}
@@ -29,6 +29,9 @@
<option value="downgrade_at_billing_cycle_end">Downgrade at the end of current billing cycle</option>
<option value="downgrade_now_without_additional_licenses">Downgrade now without creating additional invoices</option>
<option value="downgrade_now_void_open_invoices">Downgrade now and void open invoices</option>
+ {% if not remote_support_view and not current_plan.fixed_price %}
+ <option value="upgrade_plan_tier">Upgrade to the Plus plan</option>
+ {% endif %}
</select>
<button type="submit" class="support-submit-button">Modify</button>
</form>
diff --git a/templates/corporate/support/next_plan_forms_support.html b/templates/corporate/support/next_plan_forms_support.html
index e9f48d8d5fc..6e39f388fe7 100644
--- a/templates/corporate/support/next_plan_forms_support.html
+++ b/templates/corporate/support/next_plan_forms_support.html
@@ -12,7 +12,7 @@
{% endif %}
<button type="submit" class="support-submit-button">Schedule</button>
</form>
-{% if not plan_data.current_plan %}
+{% if not plan_data.current_plan and remote_support_view %}
<form method="POST" class="support-form">
<b>Configure temporary courtesy plan:</b><br />
<i>Once created, the end date for the temporary courtesy plan can be extended.</i><br />
diff --git a/templates/corporate/support/realm_details.html b/templates/corporate/support/realm_details.html
index 7604e092b61..dbc98687284 100644
--- a/templates/corporate/support/realm_details.html
+++ b/templates/corporate/support/realm_details.html
@@ -126,30 +126,12 @@
{% include 'corporate/support/current_plan_details.html' %}
{% endwith %}
- <form method="POST" class="support-form">
- <b>Billing collection method</b><br />
- {{ csrf_input }}
- <input type="hidden" name="realm_id" value="{{ realm.id }}" />
- <select name="billing_modality" class="billing-modality-select" required>
- <option value="charge_automatically" {% if realm_support_data[realm.id].plan_data.current_plan.charge_automatically %}selected{% endif %}>Charge automatically</option>
- <option value="send_invoice" {% if not realm_support_data[realm.id].plan_data.current_plan.charge_automatically %}selected{% endif %}>Pay by invoice</option>
- </select>
- <button type="submit" class="support-submit-button">Update</button>
- </form>
-
- <form method="POST" class="support-form">
- <b>Modify plan</b><br />
- {{ csrf_input }}
- <input type="hidden" name="realm_id" value="{{ realm.id }}" />
- <select name="modify_plan" class="modify-plan-method-select" required>
- <option disabled value="" selected>-- select --</option>
- <option value="downgrade_at_billing_cycle_end">Downgrade at the end of current billing cycle</option>
- <option value="downgrade_now_without_additional_licenses">Downgrade now without creating additional invoices</option>
- <option value="downgrade_now_void_open_invoices">Downgrade now and void open invoices</option>
- <option value="upgrade_plan_tier">Upgrade to the Plus plan</option>
- </select>
- <button type="submit" class="support-submit-button">Modify</button>
- </form>
+ {% with %}
+ {% set current_plan = realm_support_data[realm.id].plan_data.current_plan %}
+ {% set remote_id = realm.id %}
+ {% set remote_type = "realm_id" %}
+ {% include 'corporate/support/current_plan_forms_support.html' %}
+ {% endwith %}
</div>
{% endif %}