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() @mock_stripe()
def test_billing_page_permissions(self, *mocks: Mock) -> None: 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")) self.login_user(self.example_user("polonius"))
response = self.client_get("/upgrade/", follow=True) response = self.client_get("/upgrade/", follow=True)
self.assertEqual(response.status_code, 404) 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")) self.login_user(self.example_user("hamlet"))
response = self.client_get("/billing/") response = self.client_get("/billing/")
self.assertEqual(response.status_code, 302) self.assertEqual(response.status_code, 302)

View File

@ -52,7 +52,7 @@ def plans_view(request: HttpRequest) -> HttpResponse:
realm = get_realm_from_request(request) realm = get_realm_from_request(request)
free_trial_days = settings.FREE_TRIAL_DAYS free_trial_days = settings.FREE_TRIAL_DAYS
sponsorship_pending = False sponsorship_pending = False
sponsorship_url = "/upgrade#sponsorship" sponsorship_url = "/upgrade/#sponsorship"
if is_subdomain_root_or_alias(request): if is_subdomain_root_or_alias(request):
# If we're on the root domain, we make this link first ask you which organization. # 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})}" sponsorship_url = f"/accounts/go/?{urlencode({'next': sponsorship_url})}"

View File

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

View File

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

View File

@ -316,7 +316,7 @@
$0.80/month billed monthly $0.80/month billed monthly
</div> </div>
</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 Request education pricing
</a> </a>
</div> </div>

View File

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

View File

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

View File

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

View File

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

View File

@ -28,17 +28,17 @@
{{/if}} {{/if}}
{{#if (and is_plan_limited is_owner) }} {{#if (and is_plan_limited is_owner) }}
<li class="org-info org-upgrade small-font-size"> <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> </li>
{{/if}} {{/if}}
{{#if is_plan_limited }} {{#if is_plan_limited }}
{{#if is_education_org }} {{#if is_education_org }}
<li class="org-info org-upgrade small-font-size"> <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> </li>
{{else if (not is_business_org) }} {{else if (not is_business_org) }}
<li class="org-info org-upgrade small-font-size"> <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> </li>
{{/if}} {{/if}}
{{/if}} {{/if}}

View File

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

View File

@ -3,7 +3,7 @@
{{#if show_upgrade_message}} {{#if show_upgrade_message}}
{{#tr}} {{#tr}}
<z-link>Upgrade</z-link> for more space. <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}} {{/tr}}
{{/if}} {{/if}}
</span> </span>

View File

@ -410,8 +410,8 @@ class PlansPageTest(ZulipTestCase):
root_domain = "" root_domain = ""
result = self.client_get("/plans/", subdomain=root_domain) result = self.client_get("/plans/", subdomain=root_domain)
self.assert_in_success_response(["Self-host Zulip"], result) self.assert_in_success_response(["Self-host Zulip"], result)
self.assert_not_in_success_response(["/upgrade#sponsorship"], result) self.assert_not_in_success_response(["/upgrade/#sponsorship"], result)
self.assert_in_success_response(["/accounts/go/?next=%2Fupgrade%23sponsorship"], result) self.assert_in_success_response(["/accounts/go/?next=%2Fupgrade%2F%23sponsorship"], result)
non_existent_domain = "moo" non_existent_domain = "moo"
result = self.client_get("/plans/", subdomain=non_existent_domain) result = self.client_get("/plans/", subdomain=non_existent_domain)
@ -434,8 +434,10 @@ class PlansPageTest(ZulipTestCase):
self.login(organization_member) self.login(organization_member)
result = self.client_get("/plans/", subdomain="zulip") result = self.client_get("/plans/", subdomain="zulip")
self.assert_in_success_response(["Current plan"], result) self.assert_in_success_response(["Current plan"], result)
self.assert_in_success_response(["/upgrade#sponsorship"], result) self.assert_in_success_response(["/upgrade/#sponsorship"], result)
self.assert_not_in_success_response(["/accounts/go/?next=%2Fupgrade%23sponsorship"], result) self.assert_not_in_success_response(
["/accounts/go/?next=%2Fupgrade%2F%23sponsorship"], result
)
# Test root domain, with login on different domain # Test root domain, with login on different domain
result = self.client_get("/plans/", subdomain="") result = self.client_get("/plans/", subdomain="")