FIX: handle permalinks with query parameters (#12700)

This commit is contained in:
Régis Hanol 2021-04-14 20:03:25 +02:00 committed by GitHub
parent 6a7a8f32f1
commit c1fc2a1e9b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 5 deletions

View File

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

View File

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