From bcbb5b4dae80d630683bfc42439cb86a3150c84b Mon Sep 17 00:00:00 2001 From: Penar Musaraj Date: Thu, 27 May 2021 11:35:28 -0400 Subject: [PATCH] UX: Show grandparent category badge in sticky header on desktop (#13184) --- .../discourse/app/widgets/header-topic-info.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/app/assets/javascripts/discourse/app/widgets/header-topic-info.js b/app/assets/javascripts/discourse/app/widgets/header-topic-info.js index 3a8b1806c4..b3264a03bb 100644 --- a/app/assets/javascripts/discourse/app/widgets/header-topic-info.js +++ b/app/assets/javascripts/discourse/app/widgets/header-topic-info.js @@ -126,6 +126,18 @@ export default createWidget("header-topic-info", { const parentCategory = category.get("parentCategory"); const categories = []; if (parentCategory) { + if ( + this.siteSettings.max_category_nesting > 2 && + !this.site.mobileView + ) { + const grandParentCategory = parentCategory.get("parentCategory"); + if (grandParentCategory) { + categories.push( + this.attach("category-link", { category: grandParentCategory }) + ); + } + } + categories.push( this.attach("category-link", { category: parentCategory }) );