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)",
)
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
def is_sponsored(self) -> bool:

View File

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

View File

@ -37,8 +37,9 @@
<b>First human user</b>:
{% endif %}
</div>
<div class="realm-support-forms">
<div class="realm-form-container">
<div>
<div class="realm-management-actions">
<p class="support-section-header">🛠️ Realm management:</p>
<form method="POST" class="support-form">
<b>Status</b>:<br />
{{ csrf_input }}
@ -86,44 +87,18 @@
</select>
<button type="submit" class="support-submit-button">Update</button>
</form>
<form method="POST" class="support-form">
<b>Sponsorship pending</b>:<br />
{{ csrf_input }}
<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 %}
</div>
{% if realm.plan_type != SPONSORED_PLAN_TYPE %}
<div class="support-sponsorship-container">
{% with %}
{% set sponsorship_data = realm_support_data[realm.id].sponsorship_data %}
{% set PLAN_TYPES = REALM_PLAN_TYPES_FOR_DISCOUNT %}
{% set remote_id = realm.id %}
{% set remote_type = "realm_id" %}
{% include 'corporate/support/sponsorship_discount_forms.html' %}
{% include 'corporate/support/sponsorship_forms_support.html' %}
{% 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>
{% endif %}
{% if realm_support_data[realm.id].plan_data.current_plan %}
<div class="current-plan-container">
{% with %}

View File

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

View File

@ -91,16 +91,17 @@
{% endwith %}
{% if remote_server.deactivated %}
<div class="remote-support-sponsorship-container">
<div class="support-sponsorship-container">
{% with %}
{% set sponsorship_data = remote_servers_support_data[remote_server.id].sponsorship_data %}
{% include 'corporate/support/sponsorship_details.html' %}
{% endwith %}
</div>
{% elif remote_server.plan_type != SPONSORED_PLAN_TYPE %}
<div class="remote-support-sponsorship-container">
<div class="support-sponsorship-container">
{% with %}
{% 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_type = "remote_server_id" %}
{% 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">
<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 />
{% if sponsorship_data.has_discount %}
{% 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">
<b>Sponsorship pending</b>:<br />
{{ csrf_input }}
@ -21,7 +22,7 @@
{% endif %}
{% with %}
{% set PLAN_TYPES = REMOTE_PLAN_TIERS %}
{% set PLAN_TYPES = PLAN_TYPES %}
{% include 'corporate/support/sponsorship_discount_forms.html' %}
{% endwith %}

View File

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