mirror of
https://github.com/discourse/discourse.git
synced 2025-01-19 04:42:55 +08:00
FIX: Handle none path correctly with three levels
With a path like "/c/foo/1/none", "none" was being interpreted as an id.
This commit is contained in:
parent
3cf4ba5069
commit
c414db107c
|
@ -18,13 +18,27 @@ export default (filterArg, params) => {
|
|||
|
||||
serialize(modelParams) {
|
||||
if (!modelParams.category_slug_path_with_id) {
|
||||
modelParams.category_slug_path_with_id = [
|
||||
modelParams.parentSlug,
|
||||
modelParams.slug,
|
||||
modelParams.id
|
||||
]
|
||||
.filter(x => x)
|
||||
.join("/");
|
||||
if (modelParams.id === "none") {
|
||||
const category_slug_path_with_id = [
|
||||
modelParams.parentSlug,
|
||||
modelParams.slug
|
||||
].join("/");
|
||||
const category = Category.findBySlugPathWithID(
|
||||
category_slug_path_with_id
|
||||
);
|
||||
this.replaceWith("discovery.categoryNone", {
|
||||
category,
|
||||
category_slug_path_with_id
|
||||
});
|
||||
} else {
|
||||
modelParams.category_slug_path_with_id = [
|
||||
modelParams.parentSlug,
|
||||
modelParams.slug,
|
||||
modelParams.id
|
||||
]
|
||||
.filter(x => x)
|
||||
.join("/");
|
||||
}
|
||||
}
|
||||
|
||||
return modelParams;
|
||||
|
|
Loading…
Reference in New Issue
Block a user