From 4d51f9cad69152a0ffa8565852c4d9834ea9b8db Mon Sep 17 00:00:00 2001 From: Alan Guo Xiang Tan Date: Tue, 5 Jul 2022 13:28:51 +0800 Subject: [PATCH] UX: Enforce bullet category style in sidebar (#17334) The other category styles do not fit into how we want the sidebar to look. --- .../categories-section/category-section-link.js | 4 +++- .../acceptance/sidebar-categories-section-test.js | 14 ++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/app/assets/javascripts/discourse/app/lib/sidebar/categories-section/category-section-link.js b/app/assets/javascripts/discourse/app/lib/sidebar/categories-section/category-section-link.js index ea478618384..784b1529c7c 100644 --- a/app/assets/javascripts/discourse/app/lib/sidebar/categories-section/category-section-link.js +++ b/app/assets/javascripts/discourse/app/lib/sidebar/categories-section/category-section-link.js @@ -49,7 +49,9 @@ export default class CategorySectionLink { } get text() { - return htmlSafe(categoryBadgeHTML(this.category, { link: false })); + return htmlSafe( + categoryBadgeHTML(this.category, { link: false, categoryStyle: "bullet" }) + ); } get badgeCount() { diff --git a/app/assets/javascripts/discourse/tests/acceptance/sidebar-categories-section-test.js b/app/assets/javascripts/discourse/tests/acceptance/sidebar-categories-section-test.js index 71780134fb9..e771afdc213 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/sidebar-categories-section-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/sidebar-categories-section-test.js @@ -141,6 +141,20 @@ acceptance("Sidebar - Categories Section", function (needs) { ); }); + test("category section links uses the bullet style even when category_style site setting has been configured", async function (assert) { + this.siteSettings.category_style = "box"; + const { category1 } = setupUserSidebarCategories(); + + await visit("/"); + + assert.ok( + exists( + `.sidebar-section-categories .sidebar-section-link-${category1.slug} .badge-wrapper.bullet` + ), + "category badge uses the bullet style" + ); + }); + test("category section links", async function (assert) { const { category1, category2 } = setupUserSidebarCategories();