diff --git a/app/assets/javascripts/discourse/app/routes/unknown.js b/app/assets/javascripts/discourse/app/routes/unknown.js index 81eafa6359c..5f74049896e 100644 --- a/app/assets/javascripts/discourse/app/routes/unknown.js +++ b/app/assets/javascripts/discourse/app/routes/unknown.js @@ -3,8 +3,9 @@ import DiscourseURL from "discourse/lib/url"; import { ajax } from "discourse/lib/ajax"; export default DiscourseRoute.extend({ - model(params, transition) { - const path = params.path; + model(_, transition) { + const path = transition.intent.url; + return ajax("/permalink-check.json", { data: { path }, }).then((results) => { diff --git a/app/assets/javascripts/discourse/tests/acceptance/unknown-test.js b/app/assets/javascripts/discourse/tests/acceptance/unknown-test.js index 7910e938f0b..3f8dba03be6 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/unknown-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/unknown-test.js @@ -26,8 +26,8 @@ acceptance("Category 404", function (needs) { acceptance("Unknown", function (needs) { const urls = { - "viewtopic.php": "/t/internationalization-localization/280", - "not-the-url-for-faq": "/faq", + "/viewtopic.php?f=8&t=280": "/t/internationalization-localization/280", + "/another-url-for-faq": "/faq", }; needs.pretender((server, helper) => { @@ -59,7 +59,7 @@ acceptance("Unknown", function (needs) { }); test("Permalink URL to a static page", async function (assert) { - await visit("/not-the-url-for-faq"); + await visit("/another-url-for-faq"); assert.equal(currentURL(), "/faq"); }); });