web: Save a needless 301 redirect from /upgrade to /upgrade/.

This commit is contained in:
Alex Vandiver 2023-03-22 19:05:41 +00:00 committed by Tim Abbott
parent 061f1dc43b
commit 5967dda35d
13 changed files with 29 additions and 27 deletions

View File

@ -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)

View File

@ -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})}"

View File

@ -201,7 +201,7 @@
<center>
<p>
<h2>Your organization is on the <b>Zulip Free</b> plan.</h2>
<a href="/upgrade">
<a href="/upgrade/">
<button type="submit" class="button green">Upgrade to Standard</button>
</a>
<a href="/plans">

View File

@ -33,7 +33,7 @@
<a href="/new/" class="button">
{{ _('Create organization') }}
</a>
<a href="/accounts/go/?next=/upgrade%23sponsorship" class="button">
<a href="/accounts/go/?next=/upgrade/%23sponsorship" class="button">
{{ _('Request sponsorship') }}
</a>
<a href="/self-hosting/" class="button">
@ -55,7 +55,7 @@
<div class="bottom-text-large">
<p> Join the hundreds of communities we sponsor. Contact <a href="mailto:sales@zulip.com">
sales@zulip.com</a> to check whether your organization
qualifies, or <a href="/accounts/go/?next=/upgrade%23sponsorship">request
qualifies, or <a href="/accounts/go/?next=/upgrade/%23sponsorship">request
sponsorship</a> today.
</p>
</div>
@ -63,7 +63,7 @@
<a href="/new/" class="button">
{{ _('Create organization') }}
</a>
<a href="/accounts/go/?next=/upgrade%23sponsorship" class="button">
<a href="/accounts/go/?next=/upgrade/%23sponsorship" class="button">
{{ _('Request sponsorship') }}
</a>
<a href="/self-hosting/" class="button">

View File

@ -316,7 +316,7 @@
$0.80/month billed monthly
</div>
</div>
<a href="/accounts/go/?next=/upgrade%23sponsorship" class="button green standard-register-button">
<a href="/accounts/go/?next=/upgrade/%23sponsorship" class="button green standard-register-button">
Request education pricing
</a>
</div>

View File

@ -33,7 +33,7 @@
<a href="/new/" class="button">
{{ _('Create organization') }}
</a>
<a href="/accounts/go/?next=/upgrade%23sponsorship" class="button">
<a href="/accounts/go/?next=/upgrade/%23sponsorship" class="button">
{{ _('Request sponsorship') }}
</a>
<a href="/self-hosting/" class="button">
@ -287,7 +287,7 @@
<a href="/new/" class="button">
{{ _('Create organization') }}
</a>
<a href="/accounts/go/?next=/upgrade%23sponsorship" class="button">
<a href="/accounts/go/?next=/upgrade/%23sponsorship" class="button">
{{ _('Request sponsorship') }}
</a>
<a href="/self-hosting/" class="button">

View File

@ -35,7 +35,7 @@
<a href="/new/" class="button">
{{ _('Create organization') }}
</a>
<a href="/accounts/go/?next=/upgrade%23sponsorship" class="button">
<a href="/accounts/go/?next=/upgrade/%23sponsorship" class="button">
{{ _('Request sponsorship') }}
</a>
<a href="/self-hosting/" class="button">
@ -719,7 +719,7 @@
<a href="/new/" class="button">
{{ _('Create organization') }}
</a>
<a href="/accounts/go/?next=/upgrade%23sponsorship" class="button">
<a href="/accounts/go/?next=/upgrade/%23sponsorship" class="button">
{{ _('Request sponsorship') }}
</a>
<a href="/self-hosting/" class="button">

View File

@ -35,7 +35,7 @@
<a href="/new/" class="button">
{{ _('Create organization') }}
</a>
<a href="/accounts/go/?next=/upgrade%23sponsorship" class="button">
<a href="/accounts/go/?next=/upgrade/%23sponsorship" class="button">
{{ _('Request sponsorship') }}
</a>
<a href="/self-hosting/" class="button">
@ -401,7 +401,7 @@
<a href="/new/" class="button">
{{ _('Create organization') }}
</a>
<a href="/accounts/go/?next=/upgrade%23sponsorship" class="button">
<a href="/accounts/go/?next=/upgrade/%23sponsorship" class="button">
{{ _('Request sponsorship') }}
</a>
<a href="/self-hosting/" class="button">

View File

@ -35,7 +35,7 @@
</a>
{% elif realm.plan_type == realm.PLAN_TYPE_LIMITED or sponsorship_pending %}
<div class="pricing-details"></div>
<a href='/upgrade' class="button black-current-value" type="button">
<a href='/upgrade/' class="button black-current-value" type="button">
Current plan
</a>
{% endif %}
@ -72,7 +72,7 @@
</div>
</div>
{% if not realm %}
<a href="/upgrade" class="button green">
<a href="/upgrade/" class="button green">
{% if free_trial_days %}
Start {{ free_trial_days }} day free trial
{% else %}
@ -92,7 +92,7 @@
Sponsorship pending
</a>
{% else %}
<a href="/upgrade" class="button green">
<a href="/upgrade/" class="button green">
{% if free_trial_days %}
Start {{ free_trial_days }} day free trial
{% else %}

View File

@ -28,17 +28,17 @@
{{/if}}
{{#if (and is_plan_limited is_owner) }}
<li class="org-info org-upgrade small-font-size">
<a href="/upgrade" target="_blank" rel="noopener noreferrer" role="menuitem">{{t "Upgrade to {standard_plan_name}" }}</a>
<a href="/upgrade/" target="_blank" rel="noopener noreferrer" role="menuitem">{{t "Upgrade to {standard_plan_name}" }}</a>
</li>
{{/if}}
{{#if is_plan_limited }}
{{#if is_education_org }}
<li class="org-info org-upgrade small-font-size">
<a href="/upgrade" target="_blank" rel="noopener noreferrer" role="menuitem">{{t 'Request education pricing' }}</a>
<a href="/upgrade/" target="_blank" rel="noopener noreferrer" role="menuitem">{{t 'Request education pricing' }}</a>
</li>
{{else if (not is_business_org) }}
<li class="org-info org-upgrade small-font-size">
<a href="/upgrade" target="_blank" rel="noopener noreferrer" role="menuitem">{{t 'Request sponsorship' }}</a>
<a href="/upgrade/" target="_blank" rel="noopener noreferrer" role="menuitem">{{t 'Request sponsorship' }}</a>
</li>
{{/if}}
{{/if}}

View File

@ -1,14 +1,14 @@
<div>
{{#unless zulip_plan_is_not_limited}}
{{#if is_business_type_org}}
<a href="/upgrade" class="upgrade-tip" target="_blank" rel="noopener noreferrer">
<a href="/upgrade/" class="upgrade-tip" target="_blank" rel="noopener noreferrer">
{{upgrade_text_for_wide_organization_logo}}
</a>
{{else}}
<div class="upgrade-or-sponsorship-tip">
{{#tr}}
Available on Zulip Cloud Standard. <z-link-upgrade>Upgrade</z-link-upgrade> or <z-link-sponsorship>request sponsorship</z-link-sponsorship> to access.
{{#*inline "z-link-upgrade"}}<a href="/upgrade" target="_blank" rel="noopener noreferrer">{{> @partial-block}}</a>{{/inline}}
{{#*inline "z-link-upgrade"}}<a href="/upgrade/" target="_blank" rel="noopener noreferrer">{{> @partial-block}}</a>{{/inline}}
{{#*inline "z-link-sponsorship"}}<a href="/upgrade/#sponsorship" target="_blank" rel="noopener noreferrer">{{> @partial-block}}</a>{{/inline}}
{{/tr}}
</div>

View File

@ -3,7 +3,7 @@
{{#if show_upgrade_message}}
{{#tr}}
<z-link>Upgrade</z-link> for more space.
{{#*inline "z-link"}}<a href="/upgrade" target="_blank" rel="noopener noreferrer">{{> @partial-block }}</a>{{/inline}}
{{#*inline "z-link"}}<a href="/upgrade/" target="_blank" rel="noopener noreferrer">{{> @partial-block }}</a>{{/inline}}
{{/tr}}
{{/if}}
</span>

View File

@ -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="")