mirror of
https://github.com/discourse/discourse.git
synced 2025-04-25 14:14:33 +08:00
FIX: Handle href
admin sidebar links better (#31575)
Admin sidebar links can have either a `href` or a `route`, and the admin search was not handling this properly. Also, we should always use `getURL()` on the href in case the link is internal, for subfolder sites. This is hard to test right now, I plan on adding more extensive links for admin-search-data-source in another PR.
This commit is contained in:
parent
879faa82b3
commit
b329eac79a
@ -111,10 +111,14 @@ export default class AdminSearchDataSource extends Service {
|
||||
|
||||
#addPageLink(mapItem, link, parentLabel = "") {
|
||||
let url;
|
||||
if (link.routeModels) {
|
||||
url = this.router.urlFor(link.route, ...link.routeModels);
|
||||
} else {
|
||||
url = this.router.urlFor(link.route);
|
||||
if (link.route) {
|
||||
if (link.routeModels) {
|
||||
url = this.router.urlFor(link.route, ...link.routeModels);
|
||||
} else {
|
||||
url = this.router.urlFor(link.route);
|
||||
}
|
||||
} else if (link.href) {
|
||||
url = getURL(link.href);
|
||||
}
|
||||
|
||||
const mapItemLabel = this.#labelOrText(mapItem);
|
||||
|
@ -48,7 +48,9 @@ class SidebarAdminSectionLink extends BaseCustomSidebarSectionLink {
|
||||
}
|
||||
|
||||
get href() {
|
||||
return this.adminSidebarNavLink.href;
|
||||
if (this.adminSidebarNavLink.href) {
|
||||
return getURL(this.adminSidebarNavLink.href);
|
||||
}
|
||||
}
|
||||
|
||||
get query() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user