Skip to content

A platform for community discussion. Free, open, simple.

FIX: Regression with Categories nav item (#17885)

Penar Musaraj2c5ab4720468
diff --git a/app/assets/javascripts/discourse/app/controllers/navigation/default.js b/app/assets/javascripts/discourse/app/controllers/navigation/default.js
index b9af541cdfa..2e46e7abb17 100644
--- a/app/assets/javascripts/discourse/app/controllers/navigation/default.js
+++ b/app/assets/javascripts/discourse/app/controllers/navigation/default.js
@@ -10,6 +10,6 @@ export default Controller.extend(FilterModeMixin, {
@discourseComputed("router.currentRoute.queryParams.f")
skipCategoriesNavItem(filterParamValue) {
- return !filterParamValue || filterParamValue !== TRACKED_QUERY_PARAM_VALUE;
+ return filterParamValue === TRACKED_QUERY_PARAM_VALUE;
},
});
diff --git a/app/assets/javascripts/discourse/app/models/nav-item.js b/app/assets/javascripts/discourse/app/models/nav-item.js
index dffb6fb5d5d..c93a673ef42 100644
--- a/app/assets/javascripts/discourse/app/models/nav-item.js
+++ b/app/assets/javascripts/discourse/app/models/nav-item.js
@@ -262,7 +262,7 @@ NavItem.reopenClass({
}
if (
- (category || !args.skipCategoriesNavItem) &&
+ (category || args.skipCategoriesNavItem) &&
i.name.startsWith("categor")
) {
return false;
diff --git a/app/assets/javascripts/discourse/tests/acceptance/topic-discovery-tracked-test.js b/app/assets/javascripts/discourse/tests/acceptance/topic-discovery-tracked-test.js
index f60f66ac0b5..5fbb9f3be87 100644
--- a/app/assets/javascripts/discourse/tests/acceptance/topic-discovery-tracked-test.js
+++ b/app/assets/javascripts/discourse/tests/acceptance/topic-discovery-tracked-test.js
@@ -69,6 +69,13 @@ acceptance("Topic Discovery Tracked", function (needs) {
"the categories nav item is displayed when tracked filter is not present"
);
+ await visit("/categories");
+
+ assert.ok(
+ exists("#navigation-bar li.categories"),
+ "the categories nav item is displayed on categories route when tracked filter is not present"
+ );
+
await visit("/?f=tracked");
assert.ok(