support: Rename message -> success_message.

This commit is contained in:
Siddharth Asthana
2020-11-18 16:00:39 +05:30
committed by Alex Vandiver
parent 88a1204ce0
commit 37e158b9ba
2 changed files with 15 additions and 15 deletions

View File

@@ -1125,57 +1125,57 @@ def support(request: HttpRequest) -> HttpResponse:
current_plan_type = realm.plan_type current_plan_type = realm.plan_type
do_change_plan_type(realm, new_plan_type) do_change_plan_type(realm, new_plan_type)
msg = f"Plan type of {realm.string_id} changed from {get_plan_name(current_plan_type)} to {get_plan_name(new_plan_type)} " msg = f"Plan type of {realm.string_id} changed from {get_plan_name(current_plan_type)} to {get_plan_name(new_plan_type)} "
context["message"] = msg context["success_message"] = msg
elif request.POST.get("discount", None) is not None: elif request.POST.get("discount", None) is not None:
new_discount = Decimal(request.POST.get("discount")) new_discount = Decimal(request.POST.get("discount"))
current_discount = get_discount_for_realm(realm) current_discount = get_discount_for_realm(realm)
attach_discount_to_realm(realm, new_discount) attach_discount_to_realm(realm, new_discount)
msg = f"Discount of {realm.string_id} changed to {new_discount} from {current_discount} " msg = f"Discount of {realm.string_id} changed to {new_discount} from {current_discount} "
context["message"] = msg context["success_message"] = msg
elif request.POST.get("status", None) is not None: elif request.POST.get("status", None) is not None:
status = request.POST.get("status") status = request.POST.get("status")
if status == "active": if status == "active":
do_send_realm_reactivation_email(realm) do_send_realm_reactivation_email(realm)
context["message"] = f"Realm reactivation email sent to admins of {realm.string_id}." context["success_message"] = f"Realm reactivation email sent to admins of {realm.string_id}."
elif status == "deactivated": elif status == "deactivated":
do_deactivate_realm(realm, request.user) do_deactivate_realm(realm, request.user)
context["message"] = f"{realm.string_id} deactivated." context["success_message"] = f"{realm.string_id} deactivated."
elif request.POST.get("billing_method", None) is not None: elif request.POST.get("billing_method", None) is not None:
billing_method = request.POST.get("billing_method") billing_method = request.POST.get("billing_method")
if billing_method == "send_invoice": if billing_method == "send_invoice":
update_billing_method_of_current_plan(realm, charge_automatically=False) update_billing_method_of_current_plan(realm, charge_automatically=False)
context["message"] = f"Billing method of {realm.string_id} updated to pay by invoice." context["success_message"] = f"Billing method of {realm.string_id} updated to pay by invoice."
elif billing_method == "charge_automatically": elif billing_method == "charge_automatically":
update_billing_method_of_current_plan(realm, charge_automatically=True) update_billing_method_of_current_plan(realm, charge_automatically=True)
context["message"] = f"Billing method of {realm.string_id} updated to charge automatically." context["success_message"] = f"Billing method of {realm.string_id} updated to charge automatically."
elif request.POST.get("sponsorship_pending", None) is not None: elif request.POST.get("sponsorship_pending", None) is not None:
sponsorship_pending = request.POST.get("sponsorship_pending") sponsorship_pending = request.POST.get("sponsorship_pending")
if sponsorship_pending == "true": if sponsorship_pending == "true":
update_sponsorship_status(realm, True) update_sponsorship_status(realm, True)
context["message"] = f"{realm.string_id} marked as pending sponsorship." context["success_message"] = f"{realm.string_id} marked as pending sponsorship."
elif sponsorship_pending == "false": elif sponsorship_pending == "false":
update_sponsorship_status(realm, False) update_sponsorship_status(realm, False)
context["message"] = f"{realm.string_id} is no longer pending sponsorship." context["success_message"] = f"{realm.string_id} is no longer pending sponsorship."
elif request.POST.get('approve_sponsorship') is not None: elif request.POST.get('approve_sponsorship') is not None:
if request.POST.get('approve_sponsorship') == "approve_sponsorship": if request.POST.get('approve_sponsorship') == "approve_sponsorship":
approve_sponsorship(realm) approve_sponsorship(realm)
context["message"] = f"Sponsorship approved for {realm.string_id}" context["success_message"] = f"Sponsorship approved for {realm.string_id}"
elif request.POST.get('downgrade_method', None) is not None: elif request.POST.get('downgrade_method', None) is not None:
downgrade_method = request.POST.get('downgrade_method') downgrade_method = request.POST.get('downgrade_method')
if downgrade_method == "downgrade_at_billing_cycle_end": if downgrade_method == "downgrade_at_billing_cycle_end":
downgrade_at_the_end_of_billing_cycle(realm) downgrade_at_the_end_of_billing_cycle(realm)
context["message"] = f"{realm.string_id} marked for downgrade at the end of billing cycle" 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 downgrade_method == "downgrade_now_without_additional_licenses":
downgrade_now_without_creating_additional_invoices(realm) downgrade_now_without_creating_additional_invoices(realm)
context["message"] = f"{realm.string_id} downgraded without creating additional invoices" context["success_message"] = f"{realm.string_id} downgraded without creating additional invoices"
elif downgrade_method == "downgrade_now_void_open_invoices": elif downgrade_method == "downgrade_now_void_open_invoices":
downgrade_now_without_creating_additional_invoices(realm) downgrade_now_without_creating_additional_invoices(realm)
voided_invoices_count = void_all_open_invoices(realm) voided_invoices_count = void_all_open_invoices(realm)
context["message"] = f"{realm.string_id} downgraded and voided {voided_invoices_count} open invoices" context["success_message"] = f"{realm.string_id} downgraded and voided {voided_invoices_count} open invoices"
elif request.POST.get("scrub_realm", None) is not None: elif request.POST.get("scrub_realm", None) is not None:
if request.POST.get("scrub_realm") == "scrub_realm": if request.POST.get("scrub_realm") == "scrub_realm":
do_scrub_realm(realm, acting_user=request.user) do_scrub_realm(realm, acting_user=request.user)
context["message"] = f"{realm.string_id} scrubbed." context["success_message"] = f"{realm.string_id} scrubbed."
query = request.GET.get("q", None) query = request.GET.get("q", None)
if query: if query:

View File

@@ -18,10 +18,10 @@
</center> </center>
</form> </form>
{% if message %} {% if success_message %}
<div class="alert alert-success"> <div class="alert alert-success">
<center> <center>
{{ message }} {{ success_message }}
</center> </center>
</div> </div>
{% endif %} {% endif %}