From 5967dda35d2bfc046744869945f67010e556f0f2 Mon Sep 17 00:00:00 2001 From: Alex Vandiver Date: Wed, 22 Mar 2023 19:05:41 +0000 Subject: [PATCH] web: Save a needless 301 redirect from /upgrade to /upgrade/. --- corporate/tests/test_stripe.py | 4 ++-- corporate/views/portico.py | 2 +- templates/corporate/billing.html | 2 +- templates/corporate/for/communities.html | 6 +++--- templates/corporate/for/education.html | 2 +- templates/corporate/for/events.html | 4 ++-- templates/corporate/for/open-source.html | 4 ++-- templates/corporate/for/research.html | 4 ++-- templates/corporate/pricing_model.html | 6 +++--- web/templates/gear_menu.hbs | 6 +++--- web/templates/settings/upgrade_tip_widget.hbs | 4 ++-- web/templates/settings/upload_space_stats.hbs | 2 +- zerver/tests/test_docs.py | 10 ++++++---- 13 files changed, 29 insertions(+), 27 deletions(-) diff --git a/corporate/tests/test_stripe.py b/corporate/tests/test_stripe.py index 8ced58c60d..fa961ef3e8 100644 --- a/corporate/tests/test_stripe.py +++ b/corporate/tests/test_stripe.py @@ -4162,12 +4162,12 @@ class RequiresBillingAccessTest(StripeTestCase): @mock_stripe() def test_billing_page_permissions(self, *mocks: Mock) -> None: - # Guest users can't access /upgrade page + # Guest users can't access /upgrade/ page self.login_user(self.example_user("polonius")) response = self.client_get("/upgrade/", follow=True) self.assertEqual(response.status_code, 404) - # Check that non-admins can access /upgrade via /billing, when there is no Customer object + # Check that non-admins can access /upgrade/ via /billing, when there is no Customer object self.login_user(self.example_user("hamlet")) response = self.client_get("/billing/") self.assertEqual(response.status_code, 302) diff --git a/corporate/views/portico.py b/corporate/views/portico.py index cca62bf4b6..b787386448 100644 --- a/corporate/views/portico.py +++ b/corporate/views/portico.py @@ -52,7 +52,7 @@ def plans_view(request: HttpRequest) -> HttpResponse: realm = get_realm_from_request(request) free_trial_days = settings.FREE_TRIAL_DAYS sponsorship_pending = False - sponsorship_url = "/upgrade#sponsorship" + sponsorship_url = "/upgrade/#sponsorship" if is_subdomain_root_or_alias(request): # If we're on the root domain, we make this link first ask you which organization. sponsorship_url = f"/accounts/go/?{urlencode({'next': sponsorship_url})}" diff --git a/templates/corporate/billing.html b/templates/corporate/billing.html index 6ef160507c..f268ba9125 100644 --- a/templates/corporate/billing.html +++ b/templates/corporate/billing.html @@ -201,7 +201,7 @@

Your organization is on the Zulip Free plan.

- + diff --git a/templates/corporate/for/communities.html b/templates/corporate/for/communities.html index 96b41c3762..1e897705f5 100644 --- a/templates/corporate/for/communities.html +++ b/templates/corporate/for/communities.html @@ -33,7 +33,7 @@ {{ _('Create organization') }} - + {{ _('Request sponsorship') }} @@ -55,7 +55,7 @@ @@ -63,7 +63,7 @@ {{ _('Create organization') }} - + {{ _('Request sponsorship') }} diff --git a/templates/corporate/for/education.html b/templates/corporate/for/education.html index 1e89cfef95..14d33044ec 100644 --- a/templates/corporate/for/education.html +++ b/templates/corporate/for/education.html @@ -316,7 +316,7 @@ $0.80/month billed monthly - + Request education pricing diff --git a/templates/corporate/for/events.html b/templates/corporate/for/events.html index 7b86487185..683361734b 100644 --- a/templates/corporate/for/events.html +++ b/templates/corporate/for/events.html @@ -33,7 +33,7 @@ {{ _('Create organization') }} - + {{ _('Request sponsorship') }} @@ -287,7 +287,7 @@ {{ _('Create organization') }} - + {{ _('Request sponsorship') }} diff --git a/templates/corporate/for/open-source.html b/templates/corporate/for/open-source.html index 8f0c32ad45..de743a1a06 100644 --- a/templates/corporate/for/open-source.html +++ b/templates/corporate/for/open-source.html @@ -35,7 +35,7 @@ {{ _('Create organization') }} - + {{ _('Request sponsorship') }} @@ -719,7 +719,7 @@ {{ _('Create organization') }} - + {{ _('Request sponsorship') }} diff --git a/templates/corporate/for/research.html b/templates/corporate/for/research.html index 6445147867..fbe90238b9 100644 --- a/templates/corporate/for/research.html +++ b/templates/corporate/for/research.html @@ -35,7 +35,7 @@ {{ _('Create organization') }} - + {{ _('Request sponsorship') }} @@ -401,7 +401,7 @@ {{ _('Create organization') }} - + {{ _('Request sponsorship') }} diff --git a/templates/corporate/pricing_model.html b/templates/corporate/pricing_model.html index d93a951658..619bbe2b84 100644 --- a/templates/corporate/pricing_model.html +++ b/templates/corporate/pricing_model.html @@ -35,7 +35,7 @@ {% elif realm.plan_type == realm.PLAN_TYPE_LIMITED or sponsorship_pending %}
- + Current plan {% endif %} @@ -72,7 +72,7 @@ {% if not realm %} - + {% if free_trial_days %} Start {{ free_trial_days }} day free trial {% else %} @@ -92,7 +92,7 @@ Sponsorship pending {% else %} - + {% if free_trial_days %} Start {{ free_trial_days }} day free trial {% else %} diff --git a/web/templates/gear_menu.hbs b/web/templates/gear_menu.hbs index de98ad8830..824257b289 100644 --- a/web/templates/gear_menu.hbs +++ b/web/templates/gear_menu.hbs @@ -28,17 +28,17 @@ {{/if}} {{#if (and is_plan_limited is_owner) }}
  • - {{t "Upgrade to {standard_plan_name}" }} + {{t "Upgrade to {standard_plan_name}" }}
  • {{/if}} {{#if is_plan_limited }} {{#if is_education_org }}
  • - {{t 'Request education pricing' }} + {{t 'Request education pricing' }}
  • {{else if (not is_business_org) }}
  • - {{t 'Request sponsorship' }} + {{t 'Request sponsorship' }}
  • {{/if}} {{/if}} diff --git a/web/templates/settings/upgrade_tip_widget.hbs b/web/templates/settings/upgrade_tip_widget.hbs index 055afc8959..1b3cb65666 100644 --- a/web/templates/settings/upgrade_tip_widget.hbs +++ b/web/templates/settings/upgrade_tip_widget.hbs @@ -1,14 +1,14 @@
    {{#unless zulip_plan_is_not_limited}} {{#if is_business_type_org}} - + {{upgrade_text_for_wide_organization_logo}} {{else}}
    {{#tr}} Available on Zulip Cloud Standard. Upgrade or request sponsorship to access. - {{#*inline "z-link-upgrade"}}{{> @partial-block}}{{/inline}} + {{#*inline "z-link-upgrade"}}{{> @partial-block}}{{/inline}} {{#*inline "z-link-sponsorship"}}{{> @partial-block}}{{/inline}} {{/tr}}
    diff --git a/web/templates/settings/upload_space_stats.hbs b/web/templates/settings/upload_space_stats.hbs index c3e1ac0a23..d0aba8bf00 100644 --- a/web/templates/settings/upload_space_stats.hbs +++ b/web/templates/settings/upload_space_stats.hbs @@ -3,7 +3,7 @@ {{#if show_upgrade_message}} {{#tr}} Upgrade for more space. - {{#*inline "z-link"}}{{> @partial-block }}{{/inline}} + {{#*inline "z-link"}}{{> @partial-block }}{{/inline}} {{/tr}} {{/if}} diff --git a/zerver/tests/test_docs.py b/zerver/tests/test_docs.py index 7f54f0bef5..8e0d296303 100644 --- a/zerver/tests/test_docs.py +++ b/zerver/tests/test_docs.py @@ -410,8 +410,8 @@ class PlansPageTest(ZulipTestCase): root_domain = "" result = self.client_get("/plans/", subdomain=root_domain) self.assert_in_success_response(["Self-host Zulip"], result) - self.assert_not_in_success_response(["/upgrade#sponsorship"], result) - self.assert_in_success_response(["/accounts/go/?next=%2Fupgrade%23sponsorship"], result) + self.assert_not_in_success_response(["/upgrade/#sponsorship"], result) + self.assert_in_success_response(["/accounts/go/?next=%2Fupgrade%2F%23sponsorship"], result) non_existent_domain = "moo" result = self.client_get("/plans/", subdomain=non_existent_domain) @@ -434,8 +434,10 @@ class PlansPageTest(ZulipTestCase): self.login(organization_member) result = self.client_get("/plans/", subdomain="zulip") self.assert_in_success_response(["Current plan"], result) - self.assert_in_success_response(["/upgrade#sponsorship"], result) - self.assert_not_in_success_response(["/accounts/go/?next=%2Fupgrade%23sponsorship"], result) + self.assert_in_success_response(["/upgrade/#sponsorship"], result) + self.assert_not_in_success_response( + ["/accounts/go/?next=%2Fupgrade%2F%23sponsorship"], result + ) # Test root domain, with login on different domain result = self.client_get("/plans/", subdomain="")