FIX: Do not double-highlight admin plugin links in sidebar (#25808)

I was using adminPlugins instead of adminPlugins.index for the Installed Plugins
link in admin sidebar, which was causing Ember to highlight the main link and a plugin
link at the same time.

We only want to highlight the top level Installed Plugins link if we are on that page,
not if we are on e.g. the chat plugin admin route.
This commit is contained in:
Martin Brennan 2024-02-23 09:56:17 +10:00 committed by GitHub
parent b64a58071d
commit 1ad8e85b37
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 10 additions and 5 deletions

View File

@ -3,12 +3,11 @@ import getURL from "discourse-common/lib/get-url";
export const ADMIN_NAV_MAP = [
{
name: "plugins",
route: "adminPlugins.index",
label: "admin.plugins.title",
links: [
{
name: "admin_installed_plugins",
route: "adminPlugins",
route: "adminPlugins.index",
label: "admin.plugins.installed",
icon: "puzzle-piece",
},

View File

@ -90,7 +90,9 @@ function defineAdminSection(adminNavSectionData) {
get links() {
return this.sectionLinks.map(
(sectionLinkData) =>
new SidebarAdminSectionLink({ adminSidebarNavLink: sectionLinkData })
new SidebarAdminSectionLink({
adminSidebarNavLink: sectionLinkData,
})
);
}
@ -216,8 +218,12 @@ export default class AdminSidebarPanel extends BaseCustomSidebarPanel {
@cached
get sections() {
const currentUser = getOwnerWithFallback().lookup("service:current-user");
const siteSettings = getOwnerWithFallback().lookup("service:site-settings");
const currentUser = getOwnerWithFallback(this).lookup(
"service:current-user"
);
const siteSettings = getOwnerWithFallback(this).lookup(
"service:site-settings"
);
if (!currentUser.use_admin_sidebar) {
return [];
}