mirror of https://github.com/zulip/zulip.git
support: Mention % in attach discount success message.
This commit is contained in:
parent
bd2642a7b8
commit
7b2f16bc5c
|
@ -646,7 +646,7 @@ class TestSupportEndpoint(ZulipTestCase):
|
|||
with mock.patch("analytics.views.attach_discount_to_realm") as m:
|
||||
result = self.client_post("/activity/support", {"realm_id": f"{lear_realm.id}", "discount": "25"})
|
||||
m.assert_called_once_with(get_realm("lear"), 25)
|
||||
self.assert_in_success_response(["Discount of lear changed to 25 from None"], result)
|
||||
self.assert_in_success_response(["Discount of lear changed to 25% from 0%"], result)
|
||||
|
||||
def test_change_sponsorship_status(self) -> None:
|
||||
lear_realm = get_realm("lear")
|
||||
|
|
|
@ -1136,10 +1136,9 @@ def support(request: HttpRequest) -> HttpResponse:
|
|||
context["success_message"] = msg
|
||||
elif request.POST.get("discount", None) is not None:
|
||||
new_discount = Decimal(request.POST.get("discount"))
|
||||
current_discount = get_discount_for_realm(realm)
|
||||
current_discount = get_discount_for_realm(realm) or 0
|
||||
attach_discount_to_realm(realm, new_discount)
|
||||
msg = f"Discount of {realm.string_id} changed to {new_discount} from {current_discount} "
|
||||
context["success_message"] = msg
|
||||
context["success_message"] = f"Discount of {realm.string_id} changed to {new_discount}% from {current_discount}%."
|
||||
elif request.POST.get("new_subdomain", None) is not None:
|
||||
new_subdomain = request.POST.get("new_subdomain")
|
||||
old_subdomain = realm.string_id
|
||||
|
|
Loading…
Reference in New Issue