mirror of https://github.com/zulip/zulip.git
urls: Extend documentation URL redirects system to corporate landing pages.
Extends the URL redirect system used for documentation pages to corporate landing pages. This makes it easier and consistent for contributors who work on both areas to create new URL redirects when needed.
This commit is contained in:
parent
878b46e758
commit
5a7aa8228a
|
@ -23,6 +23,7 @@ from corporate.views.support import support_request
|
|||
from corporate.views.upgrade import initial_upgrade, sponsorship, upgrade
|
||||
from corporate.views.webhook import stripe_webhook
|
||||
from zerver.lib.rest import rest_path
|
||||
from zerver.lib.url_redirects import LANDING_PAGE_REDIRECTS
|
||||
|
||||
i18n_urlpatterns: Any = [
|
||||
# Zephyr/MIT
|
||||
|
@ -52,15 +53,11 @@ v1_api_and_json_patterns = [
|
|||
landing_page_urls = [
|
||||
# Landing page, features pages, signup form, etc.
|
||||
path("hello/", hello_view),
|
||||
path("new-user/", RedirectView.as_view(url="/hello", permanent=True)),
|
||||
path("features/", landing_view, {"template_name": "corporate/features.html"}),
|
||||
path("plans/", plans_view, name="plans"),
|
||||
path("apps/", apps_view),
|
||||
path("apps/download/<platform>", app_download_link_redirect),
|
||||
path("apps/<platform>", apps_view),
|
||||
path(
|
||||
"developer-community/", RedirectView.as_view(url="/development-community/", permanent=True)
|
||||
),
|
||||
path(
|
||||
"development-community/",
|
||||
landing_view,
|
||||
|
@ -79,17 +76,11 @@ landing_page_urls = [
|
|||
landing_view,
|
||||
{"template_name": "corporate/for/communities.html"},
|
||||
),
|
||||
# We merged this into /for/communities.
|
||||
path(
|
||||
"for/working-groups-and-communities/",
|
||||
RedirectView.as_view(url="/for/communities/", permanent=True),
|
||||
),
|
||||
path("for/education/", landing_view, {"template_name": "corporate/for/education.html"}),
|
||||
path("for/events/", landing_view, {"template_name": "corporate/for/events.html"}),
|
||||
path("for/open-source/", landing_view, {"template_name": "corporate/for/open-source.html"}),
|
||||
path("for/research/", landing_view, {"template_name": "corporate/for/research.html"}),
|
||||
path("for/business/", landing_view, {"template_name": "corporate/for/business.html"}),
|
||||
path("for/companies/", RedirectView.as_view(url="/for/business/", permanent=True)),
|
||||
# case-studies
|
||||
path(
|
||||
"case-studies/idrift/",
|
||||
|
@ -128,6 +119,12 @@ landing_page_urls = [
|
|||
),
|
||||
path("communities/", communities_view),
|
||||
]
|
||||
|
||||
# Redirects due to us having moved or combined landing pages:
|
||||
for redirect in LANDING_PAGE_REDIRECTS:
|
||||
old_url = redirect.old_url.lstrip("/")
|
||||
landing_page_urls += [path(old_url, RedirectView.as_view(url=redirect.new_url, permanent=True))]
|
||||
|
||||
i18n_urlpatterns += landing_page_urls
|
||||
|
||||
# Make a copy of i18n_urlpatterns so that they appear without prefix for English
|
||||
|
|
|
@ -481,7 +481,6 @@ def write_instrumentation_reports(full_suite: bool, include_webhooks: bool) -> N
|
|||
"confirmation_key/",
|
||||
"node-coverage/(?P<path>.+)",
|
||||
"docs/(?P<path>.+)",
|
||||
"for/working-groups-and-communities/",
|
||||
"casper/(?P<path>.+)",
|
||||
"static/(?P<path>.+)",
|
||||
"flush_caches",
|
||||
|
|
|
@ -51,6 +51,14 @@ HELP_DOCUMENTATION_REDIRECTS: List[URLRedirect] = [
|
|||
URLRedirect("/help/web-public-streams", "/help/public-access-option"),
|
||||
]
|
||||
|
||||
LANDING_PAGE_REDIRECTS = [
|
||||
# Add URL redirects for corporate landing pages here.
|
||||
URLRedirect("/new-user/", "/hello"),
|
||||
URLRedirect("/developer-community/", "/development-community"),
|
||||
URLRedirect("/for/companies/", "/for/business"),
|
||||
URLRedirect("/for/working-groups-and-communities/", "/for/communities"),
|
||||
]
|
||||
|
||||
DOCUMENTATION_REDIRECTS = (
|
||||
API_DOCUMENTATION_REDIRECTS + POLICY_DOCUMENTATION_REDIRECTS + HELP_DOCUMENTATION_REDIRECTS
|
||||
)
|
||||
|
|
|
@ -9,6 +9,7 @@ from zerver.lib.test_classes import ZulipTestCase
|
|||
from zerver.lib.url_redirects import (
|
||||
API_DOCUMENTATION_REDIRECTS,
|
||||
HELP_DOCUMENTATION_REDIRECTS,
|
||||
LANDING_PAGE_REDIRECTS,
|
||||
POLICY_DOCUMENTATION_REDIRECTS,
|
||||
)
|
||||
from zerver.models import Realm, Stream
|
||||
|
@ -176,3 +177,8 @@ class RedirectURLTest(ZulipTestCase):
|
|||
for redirect in POLICY_DOCUMENTATION_REDIRECTS:
|
||||
result = self.client_get(redirect.old_url, follow=True)
|
||||
self.assert_in_success_response(["Policies", "Archive"], result)
|
||||
|
||||
def test_landing_page_redirects(self) -> None:
|
||||
for redirect in LANDING_PAGE_REDIRECTS:
|
||||
result = self.client_get(redirect.old_url, follow=True)
|
||||
self.assert_in_success_response(["Download"], result)
|
||||
|
|
Loading…
Reference in New Issue