mirror of
https://github.com/discourse/discourse.git
synced 2024-11-24 00:37:06 +08:00
FIX: Secondary more section links not marked as active (#17797)
When the route of the link is equal to the active route, we promote it
out of the "more..." links drawer and display it directly under the
community section. This commit fixes a bug where the secondary links in
the "more..." links drawer was not being marked as active.
Follow-up to e09fd7cde2
This commit is contained in:
parent
3eaac56797
commit
ad18f7488c
|
@ -11,6 +11,8 @@ export default class SidebarMoreSectionLinks extends GlimmerComponent {
|
||||||
@tracked activeSectionLink;
|
@tracked activeSectionLink;
|
||||||
@service router;
|
@service router;
|
||||||
|
|
||||||
|
#allLinks = [...this.args.sectionLinks, ...this.args.secondarySectionLinks];
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
super(...arguments);
|
super(...arguments);
|
||||||
this.#setActiveSectionLink();
|
this.#setActiveSectionLink();
|
||||||
|
@ -89,7 +91,7 @@ export default class SidebarMoreSectionLinks extends GlimmerComponent {
|
||||||
}
|
}
|
||||||
|
|
||||||
#setActiveSectionLink() {
|
#setActiveSectionLink() {
|
||||||
const activeSectionLink = this.args.sectionLinks.find((sectionLink) => {
|
const activeSectionLink = this.#allLinks.find((sectionLink) => {
|
||||||
const args = [sectionLink.route];
|
const args = [sectionLink.route];
|
||||||
|
|
||||||
if (sectionLink.model) {
|
if (sectionLink.model) {
|
||||||
|
|
|
@ -313,6 +313,11 @@ acceptance("Sidebar - Community Section", function (needs) {
|
||||||
"/about",
|
"/about",
|
||||||
"navigates to about route correctly"
|
"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) {
|
test("navigating to FAQ from sidebar", async function (assert) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user