support: Consolidate sponsorship forms for remote and Zulip Cloud views.

In the Zulip Cloud support view, adds a "Realm management" section
for support actions that are specific to that view, (e.g., changing
an organization's type or deactivating an organization).

Moves the note about emailing organization owners when a full
sponsorship is approved for Zulip Cloud Standard to the success
message for that action, which mirrors the remote server/realm
support view.
This commit is contained in:
Lauryn Menard 2024-08-19 12:03:56 +02:00 committed by Tim Abbott
parent 85e5494507
commit b52b1bcca8
8 changed files with 25 additions and 48 deletions

View File

@ -3999,7 +3999,7 @@ class RealmBillingSession(BillingSession):
end_link="](/help/linking-to-zulip-website)", end_link="](/help/linking-to-zulip-website)",
) )
internal_send_private_message(notification_bot, user, message) internal_send_private_message(notification_bot, user, message)
return f"Sponsorship approved for {self.billing_entity_display_name}" return f"Sponsorship approved for {self.billing_entity_display_name}; Emailed organization owners and billing admins."
@override @override
def is_sponsored(self) -> bool: def is_sponsored(self) -> bool:

View File

@ -221,7 +221,7 @@ class TestRemoteServerSupportEndpoint(ZulipTestCase):
"<b>UUID</b>:", "<b>UUID</b>:",
"<b>Zulip version</b>:", "<b>Zulip version</b>:",
"📶 Push notification status:", "📶 Push notification status:",
"💸 Discount and sponsorship information:", "💸 Discounts and sponsorship information:",
], ],
result, result,
) )

View File

@ -37,8 +37,9 @@
<b>First human user</b>: <b>First human user</b>:
{% endif %} {% endif %}
</div> </div>
<div class="realm-support-forms"> <div>
<div class="realm-form-container"> <div class="realm-management-actions">
<p class="support-section-header">🛠️ Realm management:</p>
<form method="POST" class="support-form"> <form method="POST" class="support-form">
<b>Status</b>:<br /> <b>Status</b>:<br />
{{ csrf_input }} {{ csrf_input }}
@ -86,44 +87,18 @@
</select> </select>
<button type="submit" class="support-submit-button">Update</button> <button type="submit" class="support-submit-button">Update</button>
</form> </form>
<form method="POST" class="support-form"> </div>
<b>Sponsorship pending</b>:<br /> {% if realm.plan_type != SPONSORED_PLAN_TYPE %}
{{ csrf_input }} <div class="support-sponsorship-container">
<input type="hidden" name="realm_id" value="{{ realm.id }}" />
<select name="sponsorship_pending">
<option value="true" {% if realm_support_data[realm.id].sponsorship_data.sponsorship_pending %}selected{% endif %}>Yes</option>
<option value="false" {% if not realm_support_data[realm.id].sponsorship_data.sponsorship_pending %}selected{% endif %}>No</option>
</select>
<button type="submit" class="support-submit-button">Update</button>
</form>
{% if realm_support_data[realm.id].sponsorship_data.sponsorship_pending %}
<form method="POST" class="support-form">
{{ csrf_input }}
<input type="hidden" name="realm_id" value="{{ realm.id }}" />
<input type="hidden" name="approve_sponsorship" value="true" />
<button class="approve-sponsorship-button">
Approve full sponsorship
</button>
(will email organization owners)
</form>
{% endif %}
{% with %} {% with %}
{% set sponsorship_data = realm_support_data[realm.id].sponsorship_data %} {% set sponsorship_data = realm_support_data[realm.id].sponsorship_data %}
{% set PLAN_TYPES = REALM_PLAN_TYPES_FOR_DISCOUNT %} {% set PLAN_TYPES = REALM_PLAN_TYPES_FOR_DISCOUNT %}
{% set remote_id = realm.id %} {% set remote_id = realm.id %}
{% set remote_type = "realm_id" %} {% set remote_type = "realm_id" %}
{% include 'corporate/support/sponsorship_discount_forms.html' %} {% include 'corporate/support/sponsorship_forms_support.html' %}
{% endwith %} {% endwith %}
{% if realm_support_data[realm.id].sponsorship_data.sponsorship_pending %}
{% with %}
{% set latest_sponsorship_request = realm_support_data[realm.id].sponsorship_data.latest_sponsorship_request %}
{% include 'corporate/support/sponsorship_request_details.html' %}
{% endwith %}
{% endif %}
</div> </div>
{% endif %}
{% if realm_support_data[realm.id].plan_data.current_plan %} {% if realm_support_data[realm.id].plan_data.current_plan %}
<div class="current-plan-container"> <div class="current-plan-container">
{% with %} {% with %}

View File

@ -45,7 +45,7 @@
{% endwith %} {% endwith %}
{% if remote_server_deactivated %} {% if remote_server_deactivated %}
<div class="remote-support-sponsorship-container"> <div class="support-sponsorship-container">
{% with %} {% with %}
{% set sponsorship_data = support_data[remote_realm.id].sponsorship_data %} {% set sponsorship_data = support_data[remote_realm.id].sponsorship_data %}
{% set dollar_amount = dollar_amount %} {% set dollar_amount = dollar_amount %}
@ -53,9 +53,10 @@
{% endwith %} {% endwith %}
</div> </div>
{% elif remote_realm.plan_type != SPONSORED_PLAN_TYPE %} {% elif remote_realm.plan_type != SPONSORED_PLAN_TYPE %}
<div class="remote-support-sponsorship-container"> <div class="support-sponsorship-container">
{% with %} {% with %}
{% set sponsorship_data = support_data[remote_realm.id].sponsorship_data %} {% set sponsorship_data = support_data[remote_realm.id].sponsorship_data %}
{% set PLAN_TYPES = REMOTE_PLAN_TIERS %}
{% set remote_id = remote_realm.id %} {% set remote_id = remote_realm.id %}
{% set remote_type = "remote_realm_id" %} {% set remote_type = "remote_realm_id" %}
{% set has_fixed_price = support_data[remote_realm.id].plan_data.has_fixed_price %} {% set has_fixed_price = support_data[remote_realm.id].plan_data.has_fixed_price %}

View File

@ -91,16 +91,17 @@
{% endwith %} {% endwith %}
{% if remote_server.deactivated %} {% if remote_server.deactivated %}
<div class="remote-support-sponsorship-container"> <div class="support-sponsorship-container">
{% with %} {% with %}
{% set sponsorship_data = remote_servers_support_data[remote_server.id].sponsorship_data %} {% set sponsorship_data = remote_servers_support_data[remote_server.id].sponsorship_data %}
{% include 'corporate/support/sponsorship_details.html' %} {% include 'corporate/support/sponsorship_details.html' %}
{% endwith %} {% endwith %}
</div> </div>
{% elif remote_server.plan_type != SPONSORED_PLAN_TYPE %} {% elif remote_server.plan_type != SPONSORED_PLAN_TYPE %}
<div class="remote-support-sponsorship-container"> <div class="support-sponsorship-container">
{% with %} {% with %}
{% set sponsorship_data = remote_servers_support_data[remote_server.id].sponsorship_data %} {% set sponsorship_data = remote_servers_support_data[remote_server.id].sponsorship_data %}
{% set PLAN_TYPES = REMOTE_PLAN_TIERS %}
{% set remote_id = remote_server.id %} {% set remote_id = remote_server.id %}
{% set remote_type = "remote_server_id" %} {% set remote_type = "remote_server_id" %}
{% set has_fixed_price = remote_servers_support_data[remote_server.id].plan_data.has_fixed_price %} {% set has_fixed_price = remote_servers_support_data[remote_server.id].plan_data.has_fixed_price %}

View File

@ -1,5 +1,5 @@
<div class="remote-sponsorship-details"> <div class="remote-sponsorship-details">
<p class="support-section-header">💸 Discount and sponsorship information:</p> <p class="support-section-header">💸 Discounts and sponsorship information:</p>
<b>Sponsorship pending</b>: {{ sponsorship_data.sponsorship_pending }}<br /> <b>Sponsorship pending</b>: {{ sponsorship_data.sponsorship_pending }}<br />
{% if sponsorship_data.has_discount %} {% if sponsorship_data.has_discount %}
{% if sponsorship_data.monthly_discounted_price %} {% if sponsorship_data.monthly_discounted_price %}

View File

@ -1,3 +1,4 @@
<p class="support-section-header">💸 Discounts and sponsorship:</p>
<form method="POST" class="support-form"> <form method="POST" class="support-form">
<b>Sponsorship pending</b>:<br /> <b>Sponsorship pending</b>:<br />
{{ csrf_input }} {{ csrf_input }}
@ -21,7 +22,7 @@
{% endif %} {% endif %}
{% with %} {% with %}
{% set PLAN_TYPES = REMOTE_PLAN_TIERS %} {% set PLAN_TYPES = PLAN_TYPES %}
{% include 'corporate/support/sponsorship_discount_forms.html' %} {% include 'corporate/support/sponsorship_discount_forms.html' %}
{% endwith %} {% endwith %}

View File

@ -464,29 +464,28 @@ tr.admin td:first-child {
} }
.push-notification-status, .push-notification-status,
.realm-form-container, .realm-management-actions,
.next-plan-container, .next-plan-container,
.current-plan-container, .current-plan-container,
.remote-support-sponsorship-container { .support-sponsorship-container {
border-radius: 4px; border-radius: 4px;
padding: 10px; padding: 10px;
margin: 10px 0; margin: 10px 0;
} }
.push-notification-status { .push-notification-status,
.realm-management-actions {
border: 2px solid hsl(186deg 76% 36%); border: 2px solid hsl(186deg 76% 36%);
background-color: hsl(188deg 35% 87%); background-color: hsl(188deg 35% 87%);
} }
.realm-form-container,
.next-plan-container, .next-plan-container,
.current-plan-container, .current-plan-container,
.remote-support-sponsorship-container { .support-sponsorship-container {
border: 2px solid hsl(33deg 99% 60%); border: 2px solid hsl(33deg 99% 60%);
} }
.realm-form-container, .support-sponsorship-container {
.remote-support-sponsorship-container {
background-color: hsl(30deg 100% 96%); background-color: hsl(30deg 100% 96%);
} }