UX: Add badges section link to community section. (#18044)

We have a link to /badges in the old hamburger dropdown so maintaining
parity here.
This commit is contained in:
Alan Guo Xiang Tan 2022-08-23 15:42:48 +08:00 committed by GitHub
parent d390805e40
commit e3501a207f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 43 additions and 1 deletions

View File

@ -14,6 +14,7 @@ import UsersSectionLink from "discourse/lib/sidebar/user/community-section/users
import AboutSectionLink from "discourse/lib/sidebar/user/community-section/about-section-link";
import FAQSectionLink from "discourse/lib/sidebar/user/community-section/faq-section-link";
import AdminSectionLink from "discourse/lib/sidebar/user/community-section/admin-section-link";
import BadgesSectionLink from "discourse/lib/sidebar/user/community-section/badges-section-link";
import { inject as service } from "@ember/service";
import { action } from "@ember/object";
@ -27,7 +28,11 @@ const MAIN_SECTION_LINKS = [
const ADMIN_MAIN_SECTION_LINKS = [AdminSectionLink];
const MORE_SECTION_LINKS = [GroupsSectionLink, UsersSectionLink];
const MORE_SECTION_LINKS = [
GroupsSectionLink,
UsersSectionLink,
BadgesSectionLink,
];
const MORE_SECONDARY_SECTION_LINKS = [AboutSectionLink, FAQSectionLink];
export default class SidebarUserCommunitySection extends Component {

View File

@ -0,0 +1,21 @@
import I18n from "I18n";
import BaseSectionLink from "discourse/lib/sidebar/user/community-section/base-section-link";
export default class BadgesSectionLink extends BaseSectionLink {
get name() {
return "badges";
}
get route() {
return "badges";
}
get title() {
return I18n.t("badges.title");
}
get text() {
return I18n.t("badges.title");
}
}

View File

@ -229,6 +229,22 @@ acceptance("Sidebar - Logged on user - Community Section", function (needs) {
);
});
test("clicking on badges link", async function (assert) {
await visit("/");
await click(
".sidebar-section-community .sidebar-more-section-links-details-summary"
);
await click(".sidebar-section-community .sidebar-section-link-badges");
assert.strictEqual(
currentURL(),
"/badges",
"it should transition to the badges url"
);
});
test("clicking on groups link", async function (assert) {
await visit("/t/280");