Skip to content

A platform for community discussion. Free, open, simple.

FIX: Secondary more section links not marked as active (#17797)

Alan Guo Xiang Tanad18f7488cae
diff --git a/app/assets/javascripts/discourse/app/components/sidebar/more-section-links.js b/app/assets/javascripts/discourse/app/components/sidebar/more-section-links.js
index c2c5939e0eb..d339ad6edfd 100644
--- a/app/assets/javascripts/discourse/app/components/sidebar/more-section-links.js
+++ b/app/assets/javascripts/discourse/app/components/sidebar/more-section-links.js
@@ -11,6 +11,8 @@ export default class SidebarMoreSectionLinks extends GlimmerComponent {
@tracked activeSectionLink;
@service router;
+ #allLinks = [...this.args.sectionLinks, ...this.args.secondarySectionLinks];
+
constructor() {
super(...arguments);
this.#setActiveSectionLink();
@@ -89,7 +91,7 @@ export default class SidebarMoreSectionLinks extends GlimmerComponent {
}
#setActiveSectionLink() {
- const activeSectionLink = this.args.sectionLinks.find((sectionLink) => {
+ const activeSectionLink = this.#allLinks.find((sectionLink) => {
const args = [sectionLink.route];
if (sectionLink.model) {
diff --git a/app/assets/javascripts/discourse/tests/acceptance/sidebar-community-section-test.js b/app/assets/javascripts/discourse/tests/acceptance/sidebar-community-section-test.js
index 45d18320030..7528a9c077c 100644
--- a/app/assets/javascripts/discourse/tests/acceptance/sidebar-community-section-test.js
+++ b/app/assets/javascripts/discourse/tests/acceptance/sidebar-community-section-test.js
@@ -313,6 +313,11 @@ acceptance("Sidebar - Community Section", function (needs) {
"/about",
"navigates to about route correctly"
);
+
+ assert.ok(
+ exists(".sidebar-section-community .sidebar-section-link-about.active"),
+ "about section link link is displayed in the main section and marked as active"
+ );
});
test("navigating to FAQ from sidebar", async function (assert) {