Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

urls: Rename function names to match naming syntax of remote pages.

Aman Agrawalc822e953be02
diff --git a/corporate/urls.py b/corporate/urls.py
index a0129f1c600..fa0c1913c22 100644
--- a/corporate/urls.py
+++ b/corporate/urls.py
@@ -24,10 +24,10 @@ from corporate.views.portico import (
)
from corporate.views.remote_billing_page import (
remote_billing_legacy_server_login,
- remote_billing_page_realm,
- remote_billing_page_server,
- remote_billing_plans_realm,
- remote_billing_plans_server,
+ remote_realm_billing_page,
+ remote_server_billing_page,
+ remote_realm_plans_page,
+ remote_server_plans_page,
remote_server_billing_finalize_login,
)
from corporate.views.session import (
@@ -180,14 +180,14 @@ urlpatterns += [
"remote-billing-login/<signed_billing_access_token>", remote_server_billing_finalize_login
),
# Remote server billing endpoints.
- path("realm/<realm_uuid>/plans", remote_billing_plans_realm, name="remote_billing_plans_realm"),
+ path("realm/<realm_uuid>/plans", remote_realm_plans_page, name="remote_realm_plans_page"),
path(
"server/<server_uuid>/plans",
- remote_billing_plans_server,
- name="remote_billing_plans_server",
+ remote_server_plans_page,
+ name="remote_server_plans_page",
),
- path("realm/<realm_uuid>/billing", remote_billing_page_realm, name="remote_billing_page_realm"),
- path("server/<server_uuid>/billing", remote_billing_page_server, name="remote_billing_page_server"),
+ path("realm/<realm_uuid>/billing", remote_realm_billing_page, name="remote_realm_billing_page"),
+ path("server/<server_uuid>/billing", remote_server_billing_page, name="remote_server_billing_page"),
path("realm/<realm_uuid>/upgrade", remote_realm_upgrade_page, name="remote_realm_upgrade_page"),
path(
"server/<server_uuid>/upgrade",
diff --git a/corporate/views/remote_billing_page.py b/corporate/views/remote_billing_page.py
index 3c5063a6568..35223aa520f 100644
--- a/corporate/views/remote_billing_page.py
+++ b/corporate/views/remote_billing_page.py
@@ -106,9 +106,7 @@ def remote_server_billing_finalize_login(
assert identity_dict["next_page"] in VALID_NEXT_PAGES
if identity_dict["next_page"] is None:
- return HttpResponseRedirect(
- reverse("remote_billing_plans_realm", args=(remote_realm_uuid,))
- )
+ return HttpResponseRedirect(reverse("remote_realm_plans_page", args=(remote_realm_uuid,)))
else:
return HttpResponseRedirect(
reverse(f"remote_realm_{identity_dict['next_page']}_page", args=(remote_realm_uuid,))
@@ -188,8 +186,8 @@ def remote_billing_plans_common(
request: HttpRequest, realm_uuid: Optional[str], server_uuid: Optional[str]
) -> HttpResponse:
"""
- Once implemented, this function, shared between remote_billing_plans_realm
- and remote_billing_plans_server, will return a Plans page, adjusted depending
+ Once implemented, this function, shared between remote_realm_plans_page
+ and remote_server_plans_page, will return a Plans page, adjusted depending
on whether the /realm/... or /server/... endpoint is being used
"""
@@ -198,15 +196,13 @@ def remote_billing_plans_common(
@self_hosting_management_endpoint
@typed_endpoint
-def remote_billing_plans_realm(request: HttpRequest, *, realm_uuid: PathOnly[str]) -> HttpResponse:
+def remote_realm_plans_page(request: HttpRequest, *, realm_uuid: PathOnly[str]) -> HttpResponse:
return remote_billing_plans_common(request, realm_uuid=realm_uuid, server_uuid=None)
@self_hosting_management_endpoint
@typed_endpoint
-def remote_billing_plans_server(
- request: HttpRequest, *, server_uuid: PathOnly[str]
-) -> HttpResponse:
+def remote_server_plans_page(request: HttpRequest, *, server_uuid: PathOnly[str]) -> HttpResponse:
return remote_billing_plans_common(request, server_uuid=server_uuid, realm_uuid=None)
@@ -214,8 +210,8 @@ def remote_billing_page_common(
request: HttpRequest, realm_uuid: Optional[str], server_uuid: Optional[str]
) -> HttpResponse:
"""
- Once implemented, this function, shared between remote_billing_page_realm
- and remote_billing_page_server, will return a Billing page, adjusted depending
+ Once implemented, this function, shared between remote_realm_billing_page
+ and remote_server_billing_page, will return a Billing page, adjusted depending
on whether the /realm/... or /server/... endpoint is being used
"""
@@ -224,13 +220,13 @@ def remote_billing_page_common(
@self_hosting_management_endpoint
@typed_endpoint
-def remote_billing_page_server(request: HttpRequest, *, server_uuid: PathOnly[str]) -> HttpResponse:
+def remote_server_billing_page(request: HttpRequest, *, server_uuid: PathOnly[str]) -> HttpResponse:
return remote_billing_page_common(request, server_uuid=server_uuid, realm_uuid=None)
@self_hosting_management_endpoint
@typed_endpoint
-def remote_billing_page_realm(request: HttpRequest, *, realm_uuid: PathOnly[str]) -> HttpResponse:
+def remote_realm_billing_page(request: HttpRequest, *, realm_uuid: PathOnly[str]) -> HttpResponse:
return remote_billing_page_common(request, realm_uuid=realm_uuid, server_uuid=None)
@@ -285,4 +281,4 @@ def remote_billing_legacy_server_login(
authenticated_at=datetime_to_timestamp(timezone_now()),
)
- return HttpResponseRedirect(reverse("remote_billing_page_server", args=(remote_server_uuid,)))
+ return HttpResponseRedirect(reverse("remote_server_billing_page", args=(remote_server_uuid,)))
diff --git a/corporate/views/sponsorship.py b/corporate/views/sponsorship.py
index b50b1ac9ef9..45b7e72c0d4 100644
--- a/corporate/views/sponsorship.py
+++ b/corporate/views/sponsorship.py
@@ -37,7 +37,7 @@ def remote_realm_sponsorship_page(
) -> HttpResponse: # nocoverage
context = billing_session.get_sponsorship_request_context()
if context is None:
- return HttpResponseRedirect(reverse("remote_billing_page_realm"))
+ return HttpResponseRedirect(reverse("remote_realm_billing_page"))
return render(request, "corporate/sponsorship.html", context=context)
@@ -49,7 +49,7 @@ def remote_server_sponsorship_page(
) -> HttpResponse: # nocoverage
context = billing_session.get_sponsorship_request_context()
if context is None:
- return HttpResponseRedirect(reverse("remote_billing_page_server"))
+ return HttpResponseRedirect(reverse("remote_server_billing_page"))
return render(request, "corporate/sponsorship.html", context=context)