FIX: incorrect URL for tag pages inside category in subfolder setup. (#12222)
Previosuly, we didn't use `getURL` method to include the subfolder prefix in these places.
This commit is contained in:
parent
e74bdfdf8e
commit
0581c033d7
|
@ -1,6 +1,7 @@
|
|||
import Component from "@ember/component";
|
||||
import DiscourseURL from "discourse/lib/url";
|
||||
import discourseComputed from "discourse-common/utils/decorators";
|
||||
import getURL from "discourse-common/lib/get-url";
|
||||
|
||||
export default Component.extend({
|
||||
tagName: "a",
|
||||
|
@ -14,11 +15,15 @@ export default Component.extend({
|
|||
|
||||
@discourseComputed("tagId", "category")
|
||||
href(tagId, category) {
|
||||
let path;
|
||||
|
||||
if (category) {
|
||||
return "/tags" + category.url + "/" + tagId;
|
||||
path = "/tags" + category.path + "/" + tagId;
|
||||
} else {
|
||||
return "/tag/" + tagId;
|
||||
path = "/tag/" + tagId;
|
||||
}
|
||||
|
||||
return getURL(path);
|
||||
},
|
||||
|
||||
@discourseComputed("tagId")
|
||||
|
|
|
@ -498,7 +498,7 @@ export function getCategoryAndTagUrl(category, subcategories, tag) {
|
|||
let url;
|
||||
|
||||
if (category) {
|
||||
url = category.url;
|
||||
url = category.path;
|
||||
if (!subcategories) {
|
||||
url += "/none";
|
||||
}
|
||||
|
@ -510,7 +510,7 @@ export function getCategoryAndTagUrl(category, subcategories, tag) {
|
|||
: "/tag/" + tag.toLowerCase();
|
||||
}
|
||||
|
||||
return url || "/";
|
||||
return getURL(url || "/");
|
||||
}
|
||||
|
||||
export default _urlInstance;
|
||||
|
|
|
@ -128,8 +128,13 @@ const Category = RestModel.extend({
|
|||
},
|
||||
|
||||
@discourseComputed("name")
|
||||
url() {
|
||||
return getURL(`/c/${Category.slugFor(this)}/${this.id}`);
|
||||
path() {
|
||||
return `/c/${Category.slugFor(this)}/${this.id}`;
|
||||
},
|
||||
|
||||
@discourseComputed("path")
|
||||
url(path) {
|
||||
return getURL(path);
|
||||
},
|
||||
|
||||
@discourseComputed
|
||||
|
|
Loading…
Reference in New Issue