diff --git a/corporate/lib/stripe.py b/corporate/lib/stripe.py index 68b0752756..916ead14ee 100644 --- a/corporate/lib/stripe.py +++ b/corporate/lib/stripe.py @@ -3602,7 +3602,9 @@ class RemoteRealmBillingSession(BillingSession): "supports_remote_realms": self.remote_realm.server.last_api_feature_level is not None, } 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 @@ -4026,7 +4028,9 @@ class RemoteServerBillingSession(BillingSession): "supports_remote_realms": self.remote_server.last_api_feature_level is not None, } 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 diff --git a/corporate/views/billing_page.py b/corporate/views/billing_page.py index b91716779b..2d443ad13e 100644 --- a/corporate/views/billing_page.py +++ b/corporate/views/billing_page.py @@ -62,7 +62,7 @@ def billing_page( } 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: return HttpResponseRedirect(reverse("sponsorship_request")) @@ -86,7 +86,7 @@ def billing_page( context.update(main_context) 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 @@ -145,7 +145,7 @@ def remote_realm_billing_page( context.update(main_context) 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 @@ -218,7 +218,7 @@ def remote_server_billing_page( context.update(main_context) 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 @@ -319,7 +319,9 @@ def remote_server_deactivate_page( "action_url": reverse(remote_server_deactivate_page, args=[str(remote_server.uuid)]), } 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" if confirmed is None: # nocoverage @@ -330,10 +332,12 @@ def remote_server_deactivate_page( do_deactivate_remote_server(remote_server, billing_session) except ServerDeactivateWithExistingPlanError: # nocoverage 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( request, - "corporate/remote_billing_server_deactivated_success.html", + "corporate/billing/remote_billing_server_deactivated_success.html", context={"server_hostname": remote_server.hostname}, ) diff --git a/corporate/views/event_status.py b/corporate/views/event_status.py index 16542bc8d7..b0fe77315e 100644 --- a/corporate/views/event_status.py +++ b/corporate/views/event_status.py @@ -85,7 +85,7 @@ def event_status_page( "stripe_payment_intent_id": stripe_payment_intent_id, "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 @@ -103,7 +103,7 @@ def remote_realm_event_status_page( "stripe_payment_intent_id": stripe_payment_intent_id, "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 @@ -121,4 +121,4 @@ def remote_server_event_status_page( "stripe_payment_intent_id": stripe_payment_intent_id, "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) diff --git a/corporate/views/remote_billing_page.py b/corporate/views/remote_billing_page.py index 83a968d19f..2890713585 100644 --- a/corporate/views/remote_billing_page.py +++ b/corporate/views/remote_billing_page.py @@ -221,7 +221,7 @@ def remote_realm_billing_finalize_login( if server_plan is not None: return render( 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={ "server_plan_name": server_plan.name, }, @@ -265,7 +265,7 @@ def remote_realm_billing_finalize_login( } return render( request, - "corporate/remote_billing_finalize_login_confirmation.html", + "corporate/billing/remote_billing_finalize_login_confirmation.html", context=context, ) else: @@ -280,7 +280,7 @@ def remote_realm_billing_finalize_login( } return render( request, - "corporate/remote_billing_confirm_email_form.html", + "corporate/billing/remote_billing_confirm_email_form.html", context=context, ) @@ -412,7 +412,7 @@ def remote_realm_billing_confirm_email( return render( request, - "corporate/remote_billing_email_confirmation_sent.html", + "corporate/billing/remote_billing_email_confirmation_sent.html", context={"email": email}, ) @@ -522,7 +522,7 @@ def remote_billing_legacy_server_login( context: Dict[str, Any] = {"next_page": next_page} if zulip_org_id is None or zulip_org_key is None: 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": 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): 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: 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) @@ -574,7 +574,7 @@ def remote_billing_legacy_server_login( } return render( request, - "corporate/remote_billing_confirm_email_form.html", + "corporate/billing/remote_billing_confirm_email_form.html", context=context, ) @@ -641,7 +641,7 @@ def remote_billing_legacy_server_confirm_login( return render( 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}, ) @@ -714,7 +714,7 @@ def remote_billing_legacy_server_from_login_confirmation_link( } return render( request, - "corporate/remote_billing_finalize_login_confirmation.html", + "corporate/billing/remote_billing_finalize_login_confirmation.html", context=context, ) @@ -731,7 +731,7 @@ def remote_billing_legacy_server_from_login_confirmation_link( ): return render( 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: @@ -837,7 +837,7 @@ def check_rate_limits( assert e.secs_to_freedom is not None return render( request, - "corporate/remote_server_rate_limit_exceeded.html", + "corporate/billing/remote_server_rate_limit_exceeded.html", context={"retry_after": int(e.secs_to_freedom)}, status=429, ) diff --git a/corporate/views/sponsorship.py b/corporate/views/sponsorship.py index ca91d8d019..88439bac1e 100644 --- a/corporate/views/sponsorship.py +++ b/corporate/views/sponsorship.py @@ -27,7 +27,7 @@ def sponsorship_page(request: HttpRequest) -> HttpResponse: if context is None: 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 @@ -41,7 +41,7 @@ def remote_realm_sponsorship_page( 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 @@ -55,7 +55,7 @@ def remote_server_sponsorship_page( 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 diff --git a/corporate/views/upgrade.py b/corporate/views/upgrade.py index 2f648fc4af..396f16a0e5 100644 --- a/corporate/views/upgrade.py +++ b/corporate/views/upgrade.py @@ -204,7 +204,7 @@ def upgrade_page( if 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 @@ -231,7 +231,7 @@ def remote_realm_upgrade_page( if redirect_url: # nocoverage return HttpResponseRedirect(redirect_url) - response = render(request, "corporate/upgrade.html", context=context) + response = render(request, "corporate/billing/upgrade.html", context=context) return response @@ -258,5 +258,5 @@ def remote_server_upgrade_page( if redirect_url: # nocoverage return HttpResponseRedirect(redirect_url) - response = render(request, "corporate/upgrade.html", context=context) + response = render(request, "corporate/billing/upgrade.html", context=context) return response diff --git a/templates/corporate/billing.html b/templates/corporate/billing/billing.html similarity index 100% rename from templates/corporate/billing.html rename to templates/corporate/billing/billing.html diff --git a/templates/corporate/event_status.html b/templates/corporate/billing/event_status.html similarity index 100% rename from templates/corporate/event_status.html rename to templates/corporate/billing/event_status.html diff --git a/templates/corporate/legacy_server_login.html b/templates/corporate/billing/legacy_server_login.html similarity index 100% rename from templates/corporate/legacy_server_login.html rename to templates/corporate/billing/legacy_server_login.html diff --git a/templates/corporate/remote_billing_confirm_email_form.html b/templates/corporate/billing/remote_billing_confirm_email_form.html similarity index 100% rename from templates/corporate/remote_billing_confirm_email_form.html rename to templates/corporate/billing/remote_billing_confirm_email_form.html diff --git a/templates/corporate/remote_billing_email_confirmation_sent.html b/templates/corporate/billing/remote_billing_email_confirmation_sent.html similarity index 100% rename from templates/corporate/remote_billing_email_confirmation_sent.html rename to templates/corporate/billing/remote_billing_email_confirmation_sent.html diff --git a/templates/corporate/remote_billing_finalize_login_confirmation.html b/templates/corporate/billing/remote_billing_finalize_login_confirmation.html similarity index 100% rename from templates/corporate/remote_billing_finalize_login_confirmation.html rename to templates/corporate/billing/remote_billing_finalize_login_confirmation.html diff --git a/templates/corporate/remote_billing_server_deactivate.html b/templates/corporate/billing/remote_billing_server_deactivate.html similarity index 100% rename from templates/corporate/remote_billing_server_deactivate.html rename to templates/corporate/billing/remote_billing_server_deactivate.html diff --git a/templates/corporate/remote_billing_server_deactivated_success.html b/templates/corporate/billing/remote_billing_server_deactivated_success.html similarity index 100% rename from templates/corporate/remote_billing_server_deactivated_success.html rename to templates/corporate/billing/remote_billing_server_deactivated_success.html diff --git a/templates/corporate/remote_realm_login_error_for_server_on_active_plan.html b/templates/corporate/billing/remote_realm_login_error_for_server_on_active_plan.html similarity index 100% rename from templates/corporate/remote_realm_login_error_for_server_on_active_plan.html rename to templates/corporate/billing/remote_realm_login_error_for_server_on_active_plan.html diff --git a/templates/corporate/remote_server_login_error_for_any_realm_on_active_plan.html b/templates/corporate/billing/remote_server_login_error_for_any_realm_on_active_plan.html similarity index 100% rename from templates/corporate/remote_server_login_error_for_any_realm_on_active_plan.html rename to templates/corporate/billing/remote_server_login_error_for_any_realm_on_active_plan.html diff --git a/templates/corporate/remote_server_rate_limit_exceeded.html b/templates/corporate/billing/remote_server_rate_limit_exceeded.html similarity index 100% rename from templates/corporate/remote_server_rate_limit_exceeded.html rename to templates/corporate/billing/remote_server_rate_limit_exceeded.html diff --git a/templates/corporate/server_not_uploading_data.html b/templates/corporate/billing/server_not_uploading_data.html similarity index 100% rename from templates/corporate/server_not_uploading_data.html rename to templates/corporate/billing/server_not_uploading_data.html diff --git a/templates/corporate/sponsorship.html b/templates/corporate/billing/sponsorship.html similarity index 100% rename from templates/corporate/sponsorship.html rename to templates/corporate/billing/sponsorship.html diff --git a/templates/corporate/upgrade.html b/templates/corporate/billing/upgrade.html similarity index 100% rename from templates/corporate/upgrade.html rename to templates/corporate/billing/upgrade.html diff --git a/tools/linter_lib/custom_check.py b/tools/linter_lib/custom_check.py index c7fb73686b..11dca7b8db 100644 --- a/tools/linter_lib/custom_check.py +++ b/tools/linter_lib/custom_check.py @@ -666,7 +666,7 @@ html_rules: List["Rule"] = [ "the DOM is ready (inside a $(function () {...}) block).", "exclude": { "templates/zerver/development/dev_login.html", - "templates/corporate/upgrade.html", + "templates/corporate/billing/upgrade.html", }, "good_lines": ["($('#foo').on('click', function () {}"], "bad_lines": [ @@ -705,8 +705,8 @@ html_rules: List["Rule"] = [ "templates/zerver/landing_nav.html", "templates/corporate/features.html", "templates/zerver/portico-header.html", - "templates/corporate/billing.html", - "templates/corporate/upgrade.html", + "templates/corporate/billing/billing.html", + "templates/corporate/billing/upgrade.html", # Miscellaneous violations to be cleaned up "web/templates/popovers/user_card/user_card_popover_avatar.hbs", "web/templates/confirm_dialog/confirm_subscription_invites_warning.hbs",