mirror of
https://github.com/discourse/discourse.git
synced 2025-02-08 04:18:23 +00:00
FIX: Generate redirect URL correctly when using a subdirectory
The url property of a category contains the base_uri and so it shouldn't be concatated into a larger URL unless it is the prefix.
This commit is contained in:
parent
c414db107c
commit
9251065768
@ -5,6 +5,7 @@ import DiscourseURL from "discourse/lib/url";
|
|||||||
import TagsMixin from "select-kit/mixins/tags";
|
import TagsMixin from "select-kit/mixins/tags";
|
||||||
import { default as discourseComputed } from "discourse-common/utils/decorators";
|
import { default as discourseComputed } from "discourse-common/utils/decorators";
|
||||||
const { isEmpty, run } = Ember;
|
const { isEmpty, run } = Ember;
|
||||||
|
import Category from "discourse/models/category";
|
||||||
|
|
||||||
export default ComboBoxComponent.extend(TagsMixin, {
|
export default ComboBoxComponent.extend(TagsMixin, {
|
||||||
pluginApiIdentifiers: ["tag-drop"],
|
pluginApiIdentifiers: ["tag-drop"],
|
||||||
@ -78,12 +79,14 @@ export default ComboBoxComponent.extend(TagsMixin, {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@discourseComputed("firstCategory", "secondCategory")
|
@discourseComputed("currentCategory")
|
||||||
noTagsUrl() {
|
noTagsUrl(currentCategory) {
|
||||||
var url = "/tags";
|
let url = "/tags";
|
||||||
if (this.currentCategory) {
|
|
||||||
url += this.get("currentCategory.url");
|
if (currentCategory) {
|
||||||
|
url += `/c/${Category.slugFor(currentCategory)}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
return Discourse.getURL(`${url}/none`);
|
return Discourse.getURL(`${url}/none`);
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -157,9 +160,11 @@ export default ComboBoxComponent.extend(TagsMixin, {
|
|||||||
url = Discourse.getURL(this.noTagsUrl);
|
url = Discourse.getURL(this.noTagsUrl);
|
||||||
} else {
|
} else {
|
||||||
url = "/tags";
|
url = "/tags";
|
||||||
|
|
||||||
if (this.currentCategory) {
|
if (this.currentCategory) {
|
||||||
url += this.get("currentCategory.url");
|
url += `/c/${Category.slugFor(this.currentCategory)}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
url = Discourse.getURL(`${url}/${tagId.toLowerCase()}`);
|
url = Discourse.getURL(`${url}/${tagId.toLowerCase()}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user