templates: Move billing templates to /templates/corporate/billing.

This commit is contained in:
Lauryn Menard 2024-01-29 15:46:18 +01:00 committed by Tim Abbott
parent 916892e437
commit 12ec133224
21 changed files with 42 additions and 34 deletions

View File

@ -3602,7 +3602,9 @@ class RemoteRealmBillingSession(BillingSession):
"supports_remote_realms": self.remote_realm.server.last_api_feature_level is not None, "supports_remote_realms": self.remote_realm.server.last_api_feature_level is not None,
} }
return render( return render(
request, "corporate/server_not_uploading_data.html", context=missing_data_context request,
"corporate/billing/server_not_uploading_data.html",
context=missing_data_context,
) )
@override @override
@ -4026,7 +4028,9 @@ class RemoteServerBillingSession(BillingSession):
"supports_remote_realms": self.remote_server.last_api_feature_level is not None, "supports_remote_realms": self.remote_server.last_api_feature_level is not None,
} }
return render( return render(
request, "corporate/server_not_uploading_data.html", context=missing_data_context request,
"corporate/billing/server_not_uploading_data.html",
context=missing_data_context,
) )
@override @override

View File

@ -62,7 +62,7 @@ def billing_page(
} }
if not user.has_billing_access: if not user.has_billing_access:
return render(request, "corporate/billing.html", context=context) return render(request, "corporate/billing/billing.html", context=context)
if user.realm.plan_type == user.realm.PLAN_TYPE_STANDARD_FREE: if user.realm.plan_type == user.realm.PLAN_TYPE_STANDARD_FREE:
return HttpResponseRedirect(reverse("sponsorship_request")) return HttpResponseRedirect(reverse("sponsorship_request"))
@ -86,7 +86,7 @@ def billing_page(
context.update(main_context) context.update(main_context)
context["success_message"] = success_message context["success_message"] = success_message
return render(request, "corporate/billing.html", context=context) return render(request, "corporate/billing/billing.html", context=context)
@authenticated_remote_realm_management_endpoint @authenticated_remote_realm_management_endpoint
@ -145,7 +145,7 @@ def remote_realm_billing_page(
context.update(main_context) context.update(main_context)
context["success_message"] = success_message context["success_message"] = success_message
return render(request, "corporate/billing.html", context=context) return render(request, "corporate/billing/billing.html", context=context)
@authenticated_remote_server_management_endpoint @authenticated_remote_server_management_endpoint
@ -218,7 +218,7 @@ def remote_server_billing_page(
context.update(main_context) context.update(main_context)
context["success_message"] = success_message context["success_message"] = success_message
return render(request, "corporate/billing.html", context=context) return render(request, "corporate/billing/billing.html", context=context)
@require_billing_access @require_billing_access
@ -319,7 +319,9 @@ def remote_server_deactivate_page(
"action_url": reverse(remote_server_deactivate_page, args=[str(remote_server.uuid)]), "action_url": reverse(remote_server_deactivate_page, args=[str(remote_server.uuid)]),
} }
if request.method == "GET": if request.method == "GET":
return render(request, "corporate/remote_billing_server_deactivate.html", context=context) return render(
request, "corporate/billing/remote_billing_server_deactivate.html", context=context
)
assert request.method == "POST" assert request.method == "POST"
if confirmed is None: # nocoverage if confirmed is None: # nocoverage
@ -330,10 +332,12 @@ def remote_server_deactivate_page(
do_deactivate_remote_server(remote_server, billing_session) do_deactivate_remote_server(remote_server, billing_session)
except ServerDeactivateWithExistingPlanError: # nocoverage except ServerDeactivateWithExistingPlanError: # nocoverage
context["show_existing_plan_error"] = "true" context["show_existing_plan_error"] = "true"
return render(request, "corporate/remote_billing_server_deactivate.html", context=context) return render(
request, "corporate/billing/remote_billing_server_deactivate.html", context=context
)
return render( return render(
request, request,
"corporate/remote_billing_server_deactivated_success.html", "corporate/billing/remote_billing_server_deactivated_success.html",
context={"server_hostname": remote_server.hostname}, context={"server_hostname": remote_server.hostname},
) )

View File

@ -85,7 +85,7 @@ def event_status_page(
"stripe_payment_intent_id": stripe_payment_intent_id, "stripe_payment_intent_id": stripe_payment_intent_id,
"billing_base_url": "", "billing_base_url": "",
} }
return render(request, "corporate/event_status.html", context=context) return render(request, "corporate/billing/event_status.html", context=context)
@self_hosting_management_endpoint @self_hosting_management_endpoint
@ -103,7 +103,7 @@ def remote_realm_event_status_page(
"stripe_payment_intent_id": stripe_payment_intent_id, "stripe_payment_intent_id": stripe_payment_intent_id,
"billing_base_url": f"/realm/{realm_uuid}", "billing_base_url": f"/realm/{realm_uuid}",
} }
return render(request, "corporate/event_status.html", context=context) return render(request, "corporate/billing/event_status.html", context=context)
@self_hosting_management_endpoint @self_hosting_management_endpoint
@ -121,4 +121,4 @@ def remote_server_event_status_page(
"stripe_payment_intent_id": stripe_payment_intent_id, "stripe_payment_intent_id": stripe_payment_intent_id,
"billing_base_url": f"/server/{server_uuid}", "billing_base_url": f"/server/{server_uuid}",
} }
return render(request, "corporate/event_status.html", context=context) return render(request, "corporate/billing/event_status.html", context=context)

View File

@ -221,7 +221,7 @@ def remote_realm_billing_finalize_login(
if server_plan is not None: if server_plan is not None:
return render( return render(
request, request,
"corporate/remote_realm_login_error_for_server_on_active_plan.html", "corporate/billing/remote_realm_login_error_for_server_on_active_plan.html",
context={ context={
"server_plan_name": server_plan.name, "server_plan_name": server_plan.name,
}, },
@ -265,7 +265,7 @@ def remote_realm_billing_finalize_login(
} }
return render( return render(
request, request,
"corporate/remote_billing_finalize_login_confirmation.html", "corporate/billing/remote_billing_finalize_login_confirmation.html",
context=context, context=context,
) )
else: else:
@ -280,7 +280,7 @@ def remote_realm_billing_finalize_login(
} }
return render( return render(
request, request,
"corporate/remote_billing_confirm_email_form.html", "corporate/billing/remote_billing_confirm_email_form.html",
context=context, context=context,
) )
@ -412,7 +412,7 @@ def remote_realm_billing_confirm_email(
return render( return render(
request, request,
"corporate/remote_billing_email_confirmation_sent.html", "corporate/billing/remote_billing_email_confirmation_sent.html",
context={"email": email}, context={"email": email},
) )
@ -522,7 +522,7 @@ def remote_billing_legacy_server_login(
context: Dict[str, Any] = {"next_page": next_page} context: Dict[str, Any] = {"next_page": next_page}
if zulip_org_id is None or zulip_org_key is None: if zulip_org_id is None or zulip_org_key is None:
context.update({"error_message": False}) context.update({"error_message": False})
return render(request, "corporate/legacy_server_login.html", context) return render(request, "corporate/billing/legacy_server_login.html", context)
if request.method != "POST": if request.method != "POST":
return HttpResponseNotAllowed(["POST"]) return HttpResponseNotAllowed(["POST"])
@ -537,15 +537,15 @@ def remote_billing_legacy_server_login(
) )
} }
) )
return render(request, "corporate/legacy_server_login.html", context) return render(request, "corporate/billing/legacy_server_login.html", context)
if not constant_time_compare(zulip_org_key, remote_server.api_key): if not constant_time_compare(zulip_org_key, remote_server.api_key):
context.update({"error_message": _("Invalid zulip_org_key for this zulip_org_id.")}) context.update({"error_message": _("Invalid zulip_org_key for this zulip_org_id.")})
return render(request, "corporate/legacy_server_login.html", context) return render(request, "corporate/billing/legacy_server_login.html", context)
if remote_server.deactivated: if remote_server.deactivated:
context.update({"error_message": _("Your server registration has been deactivated.")}) context.update({"error_message": _("Your server registration has been deactivated.")})
return render(request, "corporate/legacy_server_login.html", context) return render(request, "corporate/billing/legacy_server_login.html", context)
remote_server_uuid = str(remote_server.uuid) remote_server_uuid = str(remote_server.uuid)
@ -574,7 +574,7 @@ def remote_billing_legacy_server_login(
} }
return render( return render(
request, request,
"corporate/remote_billing_confirm_email_form.html", "corporate/billing/remote_billing_confirm_email_form.html",
context=context, context=context,
) )
@ -641,7 +641,7 @@ def remote_billing_legacy_server_confirm_login(
return render( return render(
request, request,
"corporate/remote_billing_email_confirmation_sent.html", "corporate/billing/remote_billing_email_confirmation_sent.html",
context={"email": email, "remote_server_hostname": remote_server.hostname}, context={"email": email, "remote_server_hostname": remote_server.hostname},
) )
@ -714,7 +714,7 @@ def remote_billing_legacy_server_from_login_confirmation_link(
} }
return render( return render(
request, request,
"corporate/remote_billing_finalize_login_confirmation.html", "corporate/billing/remote_billing_finalize_login_confirmation.html",
context=context, context=context,
) )
@ -731,7 +731,7 @@ def remote_billing_legacy_server_from_login_confirmation_link(
): ):
return render( return render(
request, request,
"corporate/remote_server_login_error_for_any_realm_on_active_plan.html", "corporate/billing/remote_server_login_error_for_any_realm_on_active_plan.html",
) )
if remote_billing_user is None: if remote_billing_user is None:
@ -837,7 +837,7 @@ def check_rate_limits(
assert e.secs_to_freedom is not None assert e.secs_to_freedom is not None
return render( return render(
request, request,
"corporate/remote_server_rate_limit_exceeded.html", "corporate/billing/remote_server_rate_limit_exceeded.html",
context={"retry_after": int(e.secs_to_freedom)}, context={"retry_after": int(e.secs_to_freedom)},
status=429, status=429,
) )

View File

@ -27,7 +27,7 @@ def sponsorship_page(request: HttpRequest) -> HttpResponse:
if context is None: if context is None:
return HttpResponseRedirect(reverse("billing_page")) return HttpResponseRedirect(reverse("billing_page"))
return render(request, "corporate/sponsorship.html", context=context) return render(request, "corporate/billing/sponsorship.html", context=context)
@authenticated_remote_realm_management_endpoint @authenticated_remote_realm_management_endpoint
@ -41,7 +41,7 @@ def remote_realm_sponsorship_page(
reverse("remote_realm_billing_page", args=(billing_session.remote_realm.uuid,)) reverse("remote_realm_billing_page", args=(billing_session.remote_realm.uuid,))
) )
return render(request, "corporate/sponsorship.html", context=context) return render(request, "corporate/billing/sponsorship.html", context=context)
@authenticated_remote_server_management_endpoint @authenticated_remote_server_management_endpoint
@ -55,7 +55,7 @@ def remote_server_sponsorship_page(
reverse("remote_server_billing_page", args=(billing_session.remote_server.uuid,)) reverse("remote_server_billing_page", args=(billing_session.remote_server.uuid,))
) )
return render(request, "corporate/sponsorship.html", context=context) return render(request, "corporate/billing/sponsorship.html", context=context)
@require_organization_member @require_organization_member

View File

@ -204,7 +204,7 @@ def upgrade_page(
if redirect_url: if redirect_url:
return HttpResponseRedirect(redirect_url) return HttpResponseRedirect(redirect_url)
response = render(request, "corporate/upgrade.html", context=context) response = render(request, "corporate/billing/upgrade.html", context=context)
return response return response
@ -231,7 +231,7 @@ def remote_realm_upgrade_page(
if redirect_url: # nocoverage if redirect_url: # nocoverage
return HttpResponseRedirect(redirect_url) return HttpResponseRedirect(redirect_url)
response = render(request, "corporate/upgrade.html", context=context) response = render(request, "corporate/billing/upgrade.html", context=context)
return response return response
@ -258,5 +258,5 @@ def remote_server_upgrade_page(
if redirect_url: # nocoverage if redirect_url: # nocoverage
return HttpResponseRedirect(redirect_url) return HttpResponseRedirect(redirect_url)
response = render(request, "corporate/upgrade.html", context=context) response = render(request, "corporate/billing/upgrade.html", context=context)
return response return response

View File

@ -666,7 +666,7 @@ html_rules: List["Rule"] = [
"the DOM is ready (inside a $(function () {...}) block).", "the DOM is ready (inside a $(function () {...}) block).",
"exclude": { "exclude": {
"templates/zerver/development/dev_login.html", "templates/zerver/development/dev_login.html",
"templates/corporate/upgrade.html", "templates/corporate/billing/upgrade.html",
}, },
"good_lines": ["($('#foo').on('click', function () {}"], "good_lines": ["($('#foo').on('click', function () {}"],
"bad_lines": [ "bad_lines": [
@ -705,8 +705,8 @@ html_rules: List["Rule"] = [
"templates/zerver/landing_nav.html", "templates/zerver/landing_nav.html",
"templates/corporate/features.html", "templates/corporate/features.html",
"templates/zerver/portico-header.html", "templates/zerver/portico-header.html",
"templates/corporate/billing.html", "templates/corporate/billing/billing.html",
"templates/corporate/upgrade.html", "templates/corporate/billing/upgrade.html",
# Miscellaneous violations to be cleaned up # Miscellaneous violations to be cleaned up
"web/templates/popovers/user_card/user_card_popover_avatar.hbs", "web/templates/popovers/user_card/user_card_popover_avatar.hbs",
"web/templates/confirm_dialog/confirm_subscription_invites_warning.hbs", "web/templates/confirm_dialog/confirm_subscription_invites_warning.hbs",