From a624e6fa1cefdc8c3006d8d68c7a1e0a6c0acf45 Mon Sep 17 00:00:00 2001 From: Claas Augner Date: Fri, 17 May 2024 14:40:07 -0400 Subject: [PATCH 1/4] chore(redirects): remove retiredLocale parameter --- client/src/document/index.tsx | 11 +- .../molecules/retired-locale-note/index.tsx | 26 --- libs/fundamental-redirects/index.js | 6 +- .../integration/headless/test_redirects.py | 55 ----- testing/tests/headless.index.spec.ts | 12 +- testing/tests/redirects.test.ts | 196 +++++++++--------- 6 files changed, 103 insertions(+), 203 deletions(-) delete mode 100644 client/src/document/molecules/retired-locale-note/index.tsx diff --git a/client/src/document/index.tsx b/client/src/document/index.tsx index c23008afa717..eea243b3f246 100644 --- a/client/src/document/index.tsx +++ b/client/src/document/index.tsx @@ -25,7 +25,6 @@ import { LocalizedContentNote } from "./molecules/localized-content-note"; import { OfflineStatusBar } from "../ui/molecules/offline-status-bar"; import { TOC } from "./organisms/toc"; import { RenderSideBar } from "./organisms/sidebar"; -import { RetiredLocaleNote } from "./molecules/retired-locale-note"; import { MainContentContainer } from "../ui/atoms/page-content"; import { Loading } from "../ui/atoms/loading"; import { ArticleFooter } from "./organisms/article-footer"; @@ -213,8 +212,6 @@ export function Document(props /* TODO: define a TS interface for this */) { return null; } - const retiredLocale = searchParams.get("retiredLocale"); - return ( <>
@@ -223,16 +220,10 @@ export function Document(props /* TODO: define a TS interface for this */) {
{/* only include this if we are not server-side rendering */} {!isServer && } - {doc.isTranslated ? ( + {doc.isTranslated && (
- ) : ( - retiredLocale && ( -
- -
- ) )}
diff --git a/client/src/document/molecules/retired-locale-note/index.tsx b/client/src/document/molecules/retired-locale-note/index.tsx deleted file mode 100644 index 1af60bb0565c..000000000000 --- a/client/src/document/molecules/retired-locale-note/index.tsx +++ /dev/null @@ -1,26 +0,0 @@ -import { NoteBanner } from "../note-banner"; - -function getUrlByLocale(locale: string): string { - switch (locale) { - case "de": - case "pl": - return "https://github.com/orgs/mdn/discussions/147"; - - default: - return "https://hacks.mozilla.org/2021/03/mdn-localization-in-march-tier-1-locales-unfrozen-and-future-plans/"; - } -} - -export function RetiredLocaleNote({ locale }: { locale: string }) { - const url = getUrlByLocale(locale); - - return ( - - ); -} diff --git a/libs/fundamental-redirects/index.js b/libs/fundamental-redirects/index.js index cf98d4adfb98..7f79857d5e5f 100644 --- a/libs/fundamental-redirects/index.js +++ b/libs/fundamental-redirects/index.js @@ -106,11 +106,9 @@ const LOCALE_PATTERNS = [ )})(/(?.*)|$)`, "i" ), - ({ locale, suffix }) => { + ({ suffix }) => { const join = suffix && suffix.includes("?") ? "&" : "?"; - return `/${DEFAULT_LOCALE}/${ - (suffix || "") + join - }retiredLocale=${RETIRED_LOCALES.get(locale.toLowerCase())}`; + return `/${DEFAULT_LOCALE}/${(suffix || "") + join}`; } ), ]; diff --git a/testing/integration/headless/test_redirects.py b/testing/integration/headless/test_redirects.py index c8e45b40bc2d..ad99095b2ef2 100644 --- a/testing/integration/headless/test_redirects.py +++ b/testing/integration/headless/test_redirects.py @@ -108,58 +108,3 @@ def test_firefox_source_docs_redirects(url, base_url): def test_misc_redirects(url, base_url): url["base_url"] = base_url assert_valid_url(**url) - - -@pytest.mark.parametrize( - "retired_locale", - ( - "ar", - "bg", - "bn", - "ca", - "el", - "fa", - "fi", - "he", - "hi-IN", - "hu", - "id", - "it", - "kab", - "ms", - "my", - "nl", - "pt-PT", - "sv-SE", - "th", - "tr", - "uk", - "vi", - ), -) -@pytest.mark.parametrize( - "slug", - [ - "", - "/", - "/docs/Web", - "/docs/Web/", - "/search", - "/search/", - "/search?q=video", - "/search/?q=video", - "/settings", - ], -) -def test_retired_locale_redirects(base_url, slug, retired_locale): - """Ensure that requests for retired locales properly redirect.""" - resp = request("get", f"{base_url}/{retired_locale}{slug}") - assert resp.status_code == 302 - slug_parts = slug.split("?") - expected_slug = slug_parts[0].lstrip("/") - expected_qs = f"?retiredLocale={retired_locale}" - if len(slug_parts) > 1: - expected_qs += f"&{slug_parts[1]}" - assert ( - resp.headers["Location"] == f"/en-US/{expected_slug}{expected_qs}" - ), f"{resp.headers['Location']} is not /en-US/{expected_slug}{expected_qs}" diff --git a/testing/tests/headless.index.spec.ts b/testing/tests/headless.index.spec.ts index e80c53b6ca72..844eac7b86c3 100644 --- a/testing/tests/headless.index.spec.ts +++ b/testing/tests/headless.index.spec.ts @@ -229,15 +229,13 @@ test.describe("changing language", () => { test.describe("viewing retired locales", () => { test("redirect retired locale to English (document)", async ({ page }) => { await page.goto(testURL("/ar/docs/Web/Foo")); - expect(page.url()).toBe(testURL("/en-US/docs/Web/Foo/?retiredLocale=ar")); + expect(page.url()).toBe(testURL("/en-US/docs/Web/Foo")); expect(await page.innerText("h1")).toBe(": A test tag"); }); test("redirect retired locale to English (index.json)", async ({ page }) => { await page.goto(testURL("/ar/docs/Web/Foo/index.json")); - expect(page.url()).toBe( - testURL("/en-US/docs/Web/Foo/index.json?retiredLocale=ar") - ); + expect(page.url()).toBe(testURL("/en-US/docs/Web/Foo/index.json")); expect(await page.isVisible("text=: A test tag")).toBeTruthy(); }); @@ -245,12 +243,12 @@ test.describe("viewing retired locales", () => { page, }) => { await page.goto(testURL("/ar/search?q=video")); - expect(page.url()).toBe(testURL("/en-US/search/?q=video&retiredLocale=ar")); + expect(page.url()).toBe(testURL("/en-US/search/?q=video")); expect(await page.isVisible("text=Search results for: video")).toBeTruthy(); }); test("say the locale was retired", async ({ page }) => { - await page.goto(testURL("/en-US/docs/Web/Foo/?retiredLocale=ar")); + await page.goto(testURL("/en-US/docs/Web/Foo/")); expect( await page.isVisible("text=The page you requested has been retired") ).toBeTruthy(); @@ -264,7 +262,7 @@ test.describe("viewing retired locales", () => { test("not say the locale was retired if viewing a translated page", async ({ page, }) => { - await page.goto(testURL("/fr/docs/Web/Foo/?retiredLocale=sv-SE")); + await page.goto(testURL("/fr/docs/Web/Foo/")); expect( await page.isVisible("text=The page you requested has been retired") ).toBeFalsy(); diff --git a/testing/tests/redirects.test.ts b/testing/tests/redirects.test.ts index 51ea8521458f..504893be5c6c 100644 --- a/testing/tests/redirects.test.ts +++ b/testing/tests/redirects.test.ts @@ -939,7 +939,7 @@ const LOCALE_ALIAS_URLS = [].concat( url_test("/en-gb/docs/Foo/bar", null, { statusCode: 404 }), url_test("/en_gb/docs/Foo/bar", null, { statusCode: 404 }), - url_test("/PT-PT/docs/Foo/bar", "/en-US/docs/Foo/bar?retiredLocale=pt-PT", { + url_test("/PT-PT/docs/Foo/bar", "/en-US/docs/Foo/bar", { statusCode: 302, }), url_test("/XY-PQ/docs/Foo/bar", null, { statusCode: 404 }), @@ -966,186 +966,180 @@ const LOCALE_ALIAS_URLS = [].concat( ); const RETIRED_LOCALE_URLS = [].concat( - url_test("/ar", "/en-US/?retiredLocale=ar", { statusCode: 302 }), - url_test("/ar/", "/en-US/?retiredLocale=ar", { statusCode: 302 }), - url_test("/bg", "/en-US/?retiredLocale=bg", { statusCode: 302 }), - url_test("/bg/", "/en-US/?retiredLocale=bg", { statusCode: 302 }), - url_test("/bn", "/en-US/?retiredLocale=bn", { statusCode: 302 }), - url_test("/bn/", "/en-US/?retiredLocale=bn", { statusCode: 302 }), - url_test("/ca", "/en-US/?retiredLocale=ca", { statusCode: 302 }), - url_test("/ca/", "/en-US/?retiredLocale=ca", { statusCode: 302 }), - url_test("/el", "/en-US/?retiredLocale=el", { statusCode: 302 }), - url_test("/el/", "/en-US/?retiredLocale=el", { statusCode: 302 }), - url_test("/fa", "/en-US/?retiredLocale=fa", { statusCode: 302 }), - url_test("/FA/", "/en-US/?retiredLocale=fa", { statusCode: 302 }), - url_test("/fi", "/en-US/?retiredLocale=fi", { statusCode: 302 }), - url_test("/fi/", "/en-US/?retiredLocale=fi", { statusCode: 302 }), - url_test("/he", "/en-US/?retiredLocale=he", { statusCode: 302 }), - url_test("/he/", "/en-US/?retiredLocale=he", { statusCode: 302 }), - url_test("/hi-In", "/en-US/?retiredLocale=hi-IN", { statusCode: 302 }), - url_test("/hi-IN/", "/en-US/?retiredLocale=hi-IN", { statusCode: 302 }), - url_test("/hu", "/en-US/?retiredLocale=hu", { statusCode: 302 }), - url_test("/hu/", "/en-US/?retiredLocale=hu", { statusCode: 302 }), - url_test("/id", "/en-US/?retiredLocale=id", { statusCode: 302 }), - url_test("/ID/", "/en-US/?retiredLocale=id", { statusCode: 302 }), - url_test("/it", "/en-US/?retiredLocale=it", { statusCode: 302 }), - url_test("/it/", "/en-US/?retiredLocale=it", { statusCode: 302 }), - url_test("/kab", "/en-US/?retiredLocale=kab", { statusCode: 302 }), - url_test("/KaB/", "/en-US/?retiredLocale=kab", { statusCode: 302 }), - url_test("/ms", "/en-US/?retiredLocale=ms", { statusCode: 302 }), - url_test("/ms/", "/en-US/?retiredLocale=ms", { statusCode: 302 }), - url_test("/my", "/en-US/?retiredLocale=my", { statusCode: 302 }), - url_test("/my/", "/en-US/?retiredLocale=my", { statusCode: 302 }), - url_test("/nl", "/en-US/?retiredLocale=nl", { statusCode: 302 }), - url_test("/nl/", "/en-US/?retiredLocale=nl", { statusCode: 302 }), - url_test("/pt-Pt", "/en-US/?retiredLocale=pt-PT", { statusCode: 302 }), - url_test("/pt-PT/", "/en-US/?retiredLocale=pt-PT", { statusCode: 302 }), - url_test("/sv-SE", "/en-US/?retiredLocale=sv-SE", { statusCode: 302 }), - url_test("/sv-se/", "/en-US/?retiredLocale=sv-SE", { statusCode: 302 }), - url_test("/th", "/en-US/?retiredLocale=th", { statusCode: 302 }), - url_test("/th/", "/en-US/?retiredLocale=th", { statusCode: 302 }), - url_test("/tr", "/en-US/?retiredLocale=tr", { statusCode: 302 }), - url_test("/tr/", "/en-US/?retiredLocale=tr", { statusCode: 302 }), - url_test("/uk", "/en-US/?retiredLocale=uk", { statusCode: 302 }), - url_test("/uk/", "/en-US/?retiredLocale=uk", { statusCode: 302 }), - url_test("/vi", "/en-US/?retiredLocale=vi", { statusCode: 302 }), - url_test("/vi/", "/en-US/?retiredLocale=vi", { statusCode: 302 }), - url_test("/ar/docs/Web", "/en-US/docs/Web?retiredLocale=ar", { + url_test("/ar", "/en-US/", { statusCode: 302 }), + url_test("/ar/", "/en-US/", { statusCode: 302 }), + url_test("/bg", "/en-US/", { statusCode: 302 }), + url_test("/bg/", "/en-US/", { statusCode: 302 }), + url_test("/bn", "/en-US/", { statusCode: 302 }), + url_test("/bn/", "/en-US/", { statusCode: 302 }), + url_test("/ca", "/en-US/", { statusCode: 302 }), + url_test("/ca/", "/en-US/", { statusCode: 302 }), + url_test("/el", "/en-US/", { statusCode: 302 }), + url_test("/el/", "/en-US/", { statusCode: 302 }), + url_test("/fa", "/en-US/", { statusCode: 302 }), + url_test("/FA/", "/en-US/", { statusCode: 302 }), + url_test("/fi", "/en-US/", { statusCode: 302 }), + url_test("/fi/", "/en-US/", { statusCode: 302 }), + url_test("/he", "/en-US/", { statusCode: 302 }), + url_test("/he/", "/en-US/", { statusCode: 302 }), + url_test("/hi-In", "/en-US/", { statusCode: 302 }), + url_test("/hi-IN/", "/en-US/", { statusCode: 302 }), + url_test("/hu", "/en-US/", { statusCode: 302 }), + url_test("/hu/", "/en-US/", { statusCode: 302 }), + url_test("/id", "/en-US/", { statusCode: 302 }), + url_test("/ID/", "/en-US/", { statusCode: 302 }), + url_test("/it", "/en-US/", { statusCode: 302 }), + url_test("/it/", "/en-US/", { statusCode: 302 }), + url_test("/kab", "/en-US/", { statusCode: 302 }), + url_test("/KaB/", "/en-US/", { statusCode: 302 }), + url_test("/ms", "/en-US/", { statusCode: 302 }), + url_test("/ms/", "/en-US/", { statusCode: 302 }), + url_test("/my", "/en-US/", { statusCode: 302 }), + url_test("/my/", "/en-US/", { statusCode: 302 }), + url_test("/nl", "/en-US/", { statusCode: 302 }), + url_test("/nl/", "/en-US/", { statusCode: 302 }), + url_test("/pt-Pt", "/en-US/", { statusCode: 302 }), + url_test("/pt-PT/", "/en-US/", { statusCode: 302 }), + url_test("/sv-SE", "/en-US/", { statusCode: 302 }), + url_test("/sv-se/", "/en-US/", { statusCode: 302 }), + url_test("/th", "/en-US/", { statusCode: 302 }), + url_test("/th/", "/en-US/", { statusCode: 302 }), + url_test("/tr", "/en-US/", { statusCode: 302 }), + url_test("/tr/", "/en-US/", { statusCode: 302 }), + url_test("/uk", "/en-US/", { statusCode: 302 }), + url_test("/uk/", "/en-US/", { statusCode: 302 }), + url_test("/vi", "/en-US/", { statusCode: 302 }), + url_test("/vi/", "/en-US/", { statusCode: 302 }), + url_test("/ar/docs/Web", "/en-US/docs/Web", { statusCode: 302, }), - url_test("/bg/docs/Web/", "/en-US/docs/Web/?retiredLocale=bg", { + url_test("/bg/docs/Web/", "/en-US/docs/Web/", { statusCode: 302, }), - url_test("/bn/docs/Web", "/en-US/docs/Web?retiredLocale=bn", { + url_test("/bn/docs/Web", "/en-US/docs/Web", { statusCode: 302, }), - url_test("/Ca/docs/Web/", "/en-US/docs/Web/?retiredLocale=ca", { + url_test("/Ca/docs/Web/", "/en-US/docs/Web/", { statusCode: 302, }), - url_test("/el/docs/Web", "/en-US/docs/Web?retiredLocale=el", { + url_test("/el/docs/Web", "/en-US/docs/Web", { statusCode: 302, }), - url_test("/FA/docs/Web", "/en-US/docs/Web?retiredLocale=fa", { + url_test("/FA/docs/Web", "/en-US/docs/Web", { statusCode: 302, }), - url_test("/fi/docs/Web", "/en-US/docs/Web?retiredLocale=fi", { + url_test("/fi/docs/Web", "/en-US/docs/Web", { statusCode: 302, }), - url_test("/he/docs/Web", "/en-US/docs/Web?retiredLocale=he", { + url_test("/he/docs/Web", "/en-US/docs/Web", { statusCode: 302, }), - url_test("/hi-IN/docs/Web", "/en-US/docs/Web?retiredLocale=hi-IN", { + url_test("/hi-IN/docs/Web", "/en-US/docs/Web", { statusCode: 302, }), - url_test("/hu/docs/Web", "/en-US/docs/Web?retiredLocale=hu", { + url_test("/hu/docs/Web", "/en-US/docs/Web", { statusCode: 302, }), - url_test("/ID/docs/Web", "/en-US/docs/Web?retiredLocale=id", { + url_test("/ID/docs/Web", "/en-US/docs/Web", { statusCode: 302, }), - url_test("/it/docs/Web", "/en-US/docs/Web?retiredLocale=it", { + url_test("/it/docs/Web", "/en-US/docs/Web", { statusCode: 302, }), - url_test("/KaB/docs/Web", "/en-US/docs/Web?retiredLocale=kab", { + url_test("/KaB/docs/Web", "/en-US/docs/Web", { statusCode: 302, }), - url_test("/ms/docs/Web", "/en-US/docs/Web?retiredLocale=ms", { + url_test("/ms/docs/Web", "/en-US/docs/Web", { statusCode: 302, }), - url_test("/my/docs/Web", "/en-US/docs/Web?retiredLocale=my", { + url_test("/my/docs/Web", "/en-US/docs/Web", { statusCode: 302, }), - url_test("/nl/docs/Web", "/en-US/docs/Web?retiredLocale=nl", { + url_test("/nl/docs/Web", "/en-US/docs/Web", { statusCode: 302, }), - url_test("/pt-PT/docs/Web", "/en-US/docs/Web?retiredLocale=pt-PT", { + url_test("/pt-PT/docs/Web", "/en-US/docs/Web", { statusCode: 302, }), - url_test("/sv-se/docs/Web", "/en-US/docs/Web?retiredLocale=sv-SE", { + url_test("/sv-se/docs/Web", "/en-US/docs/Web", { statusCode: 302, }), - url_test("/th/docs/Web", "/en-US/docs/Web?retiredLocale=th", { + url_test("/th/docs/Web", "/en-US/docs/Web", { statusCode: 302, }), - url_test("/tr/docs/Web", "/en-US/docs/Web?retiredLocale=tr", { + url_test("/tr/docs/Web", "/en-US/docs/Web", { statusCode: 302, }), - url_test("/uk/docs/Web", "/en-US/docs/Web?retiredLocale=uk", { + url_test("/uk/docs/Web", "/en-US/docs/Web", { statusCode: 302, }), - url_test("/vi/docs/Web", "/en-US/docs/Web?retiredLocale=vi", { + url_test("/vi/docs/Web", "/en-US/docs/Web", { statusCode: 302, }), - url_test("/ar/search?q=video", "/en-US/search?q=video&retiredLocale=ar", { + url_test("/ar/search?q=video", "/en-US/search?q=video", { statusCode: 302, }), - url_test("/bg/search?q=video", "/en-US/search?q=video&retiredLocale=bg", { + url_test("/bg/search?q=video", "/en-US/search?q=video", { statusCode: 302, }), - url_test("/bn/search?q=video", "/en-US/search?q=video&retiredLocale=bn", { + url_test("/bn/search?q=video", "/en-US/search?q=video", { statusCode: 302, }), - url_test("/Ca/search?q=video", "/en-US/search?q=video&retiredLocale=ca", { + url_test("/Ca/search?q=video", "/en-US/search?q=video", { statusCode: 302, }), - url_test("/el/search?q=video", "/en-US/search?q=video&retiredLocale=el", { + url_test("/el/search?q=video", "/en-US/search?q=video", { statusCode: 302, }), - url_test("/FA/search?q=video", "/en-US/search?q=video&retiredLocale=fa", { + url_test("/FA/search?q=video", "/en-US/search?q=video", { statusCode: 302, }), - url_test("/fi/search?q=video", "/en-US/search?q=video&retiredLocale=fi", { + url_test("/fi/search?q=video", "/en-US/search?q=video", { statusCode: 302, }), - url_test("/he/search?q=video", "/en-US/search?q=video&retiredLocale=he", { + url_test("/he/search?q=video", "/en-US/search?q=video", { statusCode: 302, }), - url_test( - "/hi-IN/search?q=video", - "/en-US/search?q=video&retiredLocale=hi-IN", - { statusCode: 302 } - ), - url_test("/hu/search?q=video", "/en-US/search?q=video&retiredLocale=hu", { + url_test("/hi-IN/search?q=video", "/en-US/search?q=video", { statusCode: 302, }), - url_test("/ID/search?q=video", "/en-US/search?q=video&retiredLocale=id", { + url_test("/hu/search?q=video", "/en-US/search?q=video", { statusCode: 302, }), - url_test("/it/search?q=video", "/en-US/search?q=video&retiredLocale=it", { + url_test("/ID/search?q=video", "/en-US/search?q=video", { statusCode: 302, }), - url_test("/KaB/search?q=video", "/en-US/search?q=video&retiredLocale=kab", { + url_test("/it/search?q=video", "/en-US/search?q=video", { statusCode: 302, }), - url_test("/ms/search?q=video", "/en-US/search?q=video&retiredLocale=ms", { + url_test("/KaB/search?q=video", "/en-US/search?q=video", { statusCode: 302, }), - url_test("/my/search?q=video", "/en-US/search?q=video&retiredLocale=my", { + url_test("/ms/search?q=video", "/en-US/search?q=video", { statusCode: 302, }), - url_test("/nl/search?q=video", "/en-US/search?q=video&retiredLocale=nl", { + url_test("/my/search?q=video", "/en-US/search?q=video", { statusCode: 302, }), - url_test( - "/pt-PT/search?q=video", - "/en-US/search?q=video&retiredLocale=pt-PT", - { statusCode: 302 } - ), - url_test( - "/sv-se/search?q=video", - "/en-US/search?q=video&retiredLocale=sv-SE", - { statusCode: 302 } - ), - url_test("/th/search?q=video", "/en-US/search?q=video&retiredLocale=th", { + url_test("/nl/search?q=video", "/en-US/search?q=video", { + statusCode: 302, + }), + url_test("/pt-PT/search?q=video", "/en-US/search?q=video", { + statusCode: 302, + }), + url_test("/sv-se/search?q=video", "/en-US/search?q=video", { + statusCode: 302, + }), + url_test("/th/search?q=video", "/en-US/search?q=video", { statusCode: 302, }), - url_test("/tr/search?q=video", "/en-US/search?q=video&retiredLocale=tr", { + url_test("/tr/search?q=video", "/en-US/search?q=video", { statusCode: 302, }), - url_test("/uk/search?q=video", "/en-US/search?q=video&retiredLocale=uk", { + url_test("/uk/search?q=video", "/en-US/search?q=video", { statusCode: 302, }), - url_test("/vi/search?q=video", "/en-US/search?q=video&retiredLocale=vi", { + url_test("/vi/search?q=video", "/en-US/search?q=video", { statusCode: 302, }) ); From ac817b6c3f2ebe49101c8d6291138f5b91e0ba27 Mon Sep 17 00:00:00 2001 From: Claas Augner Date: Fri, 17 May 2024 15:25:28 -0400 Subject: [PATCH 2/4] fixup! chore(redirects): remove retiredLocale parameter --- client/src/document/index.tsx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/client/src/document/index.tsx b/client/src/document/index.tsx index eea243b3f246..bc19fe391833 100644 --- a/client/src/document/index.tsx +++ b/client/src/document/index.tsx @@ -1,5 +1,5 @@ import React from "react"; -import { useSearchParams, useNavigate } from "react-router-dom"; +import { useNavigate } from "react-router-dom"; import useSWR, { mutate } from "swr"; import { WRITER_MODE, PLACEMENT_ENABLED } from "../env"; @@ -73,7 +73,6 @@ export function Document(props /* TODO: define a TS interface for this */) { const mountCounter = React.useRef(0); const documentURL = useDocumentURL(); const locale = useLocale(); - const [searchParams] = useSearchParams(); const navigate = useNavigate(); From 5369bbf28597d55f44424e3a826b577323076eee Mon Sep 17 00:00:00 2001 From: Claas Augner Date: Fri, 17 May 2024 15:38:11 -0400 Subject: [PATCH 3/4] fixup! chore(redirects): remove retiredLocale parameter --- libs/fundamental-redirects/index.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/libs/fundamental-redirects/index.js b/libs/fundamental-redirects/index.js index 7f79857d5e5f..c4e07554e6bc 100644 --- a/libs/fundamental-redirects/index.js +++ b/libs/fundamental-redirects/index.js @@ -107,8 +107,7 @@ const LOCALE_PATTERNS = [ "i" ), ({ suffix }) => { - const join = suffix && suffix.includes("?") ? "&" : "?"; - return `/${DEFAULT_LOCALE}/${(suffix || "") + join}`; + return `/${DEFAULT_LOCALE}/${suffix || ""}`; } ), ]; From 0878b35dad5d9be05271637759612d9a3a41a175 Mon Sep 17 00:00:00 2001 From: Claas Augner Date: Fri, 17 May 2024 16:11:16 -0400 Subject: [PATCH 4/4] fixup! chore(redirects): remove retiredLocale parameter --- testing/tests/headless.index.spec.ts | 23 +---------------------- 1 file changed, 1 insertion(+), 22 deletions(-) diff --git a/testing/tests/headless.index.spec.ts b/testing/tests/headless.index.spec.ts index 844eac7b86c3..5f3a631911ea 100644 --- a/testing/tests/headless.index.spec.ts +++ b/testing/tests/headless.index.spec.ts @@ -229,7 +229,7 @@ test.describe("changing language", () => { test.describe("viewing retired locales", () => { test("redirect retired locale to English (document)", async ({ page }) => { await page.goto(testURL("/ar/docs/Web/Foo")); - expect(page.url()).toBe(testURL("/en-US/docs/Web/Foo")); + expect(page.url()).toBe(testURL("/en-US/docs/Web/Foo/")); expect(await page.innerText("h1")).toBe(": A test tag"); }); @@ -246,25 +246,4 @@ test.describe("viewing retired locales", () => { expect(page.url()).toBe(testURL("/en-US/search/?q=video")); expect(await page.isVisible("text=Search results for: video")).toBeTruthy(); }); - - test("say the locale was retired", async ({ page }) => { - await page.goto(testURL("/en-US/docs/Web/Foo/")); - expect( - await page.isVisible("text=The page you requested has been retired") - ).toBeTruthy(); - // sanity check that it goes away - await page.goto(testURL("/en-US/docs/Web/Foo/")); - expect( - await page.isVisible("text=The page you requested has been retired") - ).toBeFalsy(); - }); - - test("not say the locale was retired if viewing a translated page", async ({ - page, - }) => { - await page.goto(testURL("/fr/docs/Web/Foo/")); - expect( - await page.isVisible("text=The page you requested has been retired") - ).toBeFalsy(); - }); });