mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
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 Component from "@ember/component";
|
||||||
import DiscourseURL from "discourse/lib/url";
|
import DiscourseURL from "discourse/lib/url";
|
||||||
import discourseComputed from "discourse-common/utils/decorators";
|
import discourseComputed from "discourse-common/utils/decorators";
|
||||||
|
import getURL from "discourse-common/lib/get-url";
|
||||||
|
|
||||||
export default Component.extend({
|
export default Component.extend({
|
||||||
tagName: "a",
|
tagName: "a",
|
||||||
@ -14,11 +15,15 @@ export default Component.extend({
|
|||||||
|
|
||||||
@discourseComputed("tagId", "category")
|
@discourseComputed("tagId", "category")
|
||||||
href(tagId, category) {
|
href(tagId, category) {
|
||||||
|
let path;
|
||||||
|
|
||||||
if (category) {
|
if (category) {
|
||||||
return "/tags" + category.url + "/" + tagId;
|
path = "/tags" + category.path + "/" + tagId;
|
||||||
} else {
|
} else {
|
||||||
return "/tag/" + tagId;
|
path = "/tag/" + tagId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return getURL(path);
|
||||||
},
|
},
|
||||||
|
|
||||||
@discourseComputed("tagId")
|
@discourseComputed("tagId")
|
||||||
|
@ -498,7 +498,7 @@ export function getCategoryAndTagUrl(category, subcategories, tag) {
|
|||||||
let url;
|
let url;
|
||||||
|
|
||||||
if (category) {
|
if (category) {
|
||||||
url = category.url;
|
url = category.path;
|
||||||
if (!subcategories) {
|
if (!subcategories) {
|
||||||
url += "/none";
|
url += "/none";
|
||||||
}
|
}
|
||||||
@ -510,7 +510,7 @@ export function getCategoryAndTagUrl(category, subcategories, tag) {
|
|||||||
: "/tag/" + tag.toLowerCase();
|
: "/tag/" + tag.toLowerCase();
|
||||||
}
|
}
|
||||||
|
|
||||||
return url || "/";
|
return getURL(url || "/");
|
||||||
}
|
}
|
||||||
|
|
||||||
export default _urlInstance;
|
export default _urlInstance;
|
||||||
|
@ -128,8 +128,13 @@ const Category = RestModel.extend({
|
|||||||
},
|
},
|
||||||
|
|
||||||
@discourseComputed("name")
|
@discourseComputed("name")
|
||||||
url() {
|
path() {
|
||||||
return getURL(`/c/${Category.slugFor(this)}/${this.id}`);
|
return `/c/${Category.slugFor(this)}/${this.id}`;
|
||||||
|
},
|
||||||
|
|
||||||
|
@discourseComputed("path")
|
||||||
|
url(path) {
|
||||||
|
return getURL(path);
|
||||||
},
|
},
|
||||||
|
|
||||||
@discourseComputed
|
@discourseComputed
|
||||||
|
Loading…
Reference in New Issue
Block a user