support: Rename "downgrade plan" to "modify plan".

Just a naming change to facilitate adding more options to that <select>
- mainly, an option to upgrade the plan to Plus.
This commit is contained in:
Mateusz Mandera 2023-04-11 00:14:41 +02:00 committed by Tim Abbott
parent 10adb6c183
commit 1a15449e16
4 changed files with 14 additions and 14 deletions

View File

@ -627,7 +627,7 @@ class TestSupportEndpoint(ZulipTestCase):
"/activity/support",
{
"realm_id": f"{iago.realm_id}",
"downgrade_method": "downgrade_at_billing_cycle_end",
"modify_plan": "downgrade_at_billing_cycle_end",
},
)
m.assert_called_once_with(get_realm("zulip"))
@ -642,7 +642,7 @@ class TestSupportEndpoint(ZulipTestCase):
"/activity/support",
{
"realm_id": f"{iago.realm_id}",
"downgrade_method": "downgrade_now_without_additional_licenses",
"modify_plan": "downgrade_now_without_additional_licenses",
},
)
m.assert_called_once_with(get_realm("zulip"))
@ -658,7 +658,7 @@ class TestSupportEndpoint(ZulipTestCase):
"/activity/support",
{
"realm_id": f"{iago.realm_id}",
"downgrade_method": "downgrade_now_void_open_invoices",
"modify_plan": "downgrade_now_void_open_invoices",
},
)
m1.assert_called_once_with(get_realm("zulip"))

View File

@ -121,7 +121,7 @@ def get_confirmations(
return confirmation_dicts
VALID_DOWNGRADE_METHODS = [
VALID_MODIFY_PLAN_METHODS = [
"downgrade_at_billing_cycle_end",
"downgrade_now_without_additional_licenses",
"downgrade_now_void_open_invoices",
@ -160,8 +160,8 @@ def support(
),
sponsorship_pending: Optional[bool] = REQ(default=None, json_validator=check_bool),
approve_sponsorship: bool = REQ(default=False, json_validator=check_bool),
downgrade_method: Optional[str] = REQ(
default=None, str_validator=check_string_in(VALID_DOWNGRADE_METHODS)
modify_plan: Optional[str] = REQ(
default=None, str_validator=check_string_in(VALID_MODIFY_PLAN_METHODS)
),
scrub_realm: bool = REQ(default=False, json_validator=check_bool),
query: Optional[str] = REQ("q", default=None),
@ -251,18 +251,18 @@ def support(
elif approve_sponsorship:
do_approve_sponsorship(realm, acting_user=acting_user)
context["success_message"] = f"Sponsorship approved for {realm.string_id}"
elif downgrade_method is not None:
if downgrade_method == "downgrade_at_billing_cycle_end":
elif modify_plan is not None:
if modify_plan == "downgrade_at_billing_cycle_end":
downgrade_at_the_end_of_billing_cycle(realm)
context[
"success_message"
] = f"{realm.string_id} marked for downgrade at the end of billing cycle"
elif downgrade_method == "downgrade_now_without_additional_licenses":
elif modify_plan == "downgrade_now_without_additional_licenses":
downgrade_now_without_creating_additional_invoices(realm)
context[
"success_message"
] = f"{realm.string_id} downgraded without creating additional invoices"
elif downgrade_method == "downgrade_now_void_open_invoices":
elif modify_plan == "downgrade_now_void_open_invoices":
downgrade_now_without_creating_additional_invoices(realm)
voided_invoices_count = void_all_open_invoices(realm)
context[

View File

@ -137,16 +137,16 @@
<form method="POST" class="downgrade-plan-form">
<br />
<b>Downgrade plan</b><br />
<b>Modify plan</b><br />
{{ csrf_input }}
<input type="hidden" name="realm_id" value="{{ realm.id }}" />
<select name="downgrade_method" class="downgrade-plan-method-select" required>
<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>
</select>
<button type="submit" class="btn btn-default support-submit-button">Downgrade</button>
<button type="submit" class="btn btn-default support-submit-button">Modify</button>
</form>
{% endif %}

View File

@ -124,7 +124,7 @@ tr.admin td:first-child {
top: -75px;
}
.downgrade-plan-method-select {
.modify-plan-method-select {
width: auto;
}