FIX: shows parent category name in title anchor (#7576)

FIX: shows parent category name in title anchor (#7576)

diff --git a/app/assets/javascripts/discourse/routes/build-category-route.js.es6 b/app/assets/javascripts/discourse/routes/build-category-route.js.es6
index 182571c..2726bac 100644
--- a/app/assets/javascripts/discourse/routes/build-category-route.js.es6
+++ b/app/assets/javascripts/discourse/routes/build-category-route.js.es6
@@ -110,14 +110,22 @@ export default (filterArg, params) => {
     },
 
     titleToken() {
-      const category = this.currentModel.category,
-        filterText = I18n.t(
-          "filters." + this.filter(category).replace("/", ".") + ".title"
-        );
+      const category = this.currentModel.category;
+
+      const filterText = I18n.t(
+        "filters." + this.filter(category).replace("/", ".") + ".title"
+      );
+
+      let categoryName = category.name;
+      if (category.parent_category_id) {
+        const list = Category.list();
+        const parentCategory = list.findBy("id", category.parent_category_id);
+        categoryName = `${parentCategory.name}/${categoryName}`;
+      }
 
       return I18n.t("filters.with_category", {
         filter: filterText,
-        category: category.get("name")
+        category: categoryName
       });
     },

GitHub sha: 236adc9c

1 Like