Skip to content

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

FIX: NavItem active state ignoring routeParam (#38170)

Osama Sayeghea0c186d0473
diff --git a/frontend/discourse/app/components/nav-item.gjs b/frontend/discourse/app/components/nav-item.gjs
index def51ae525d..c4ac34fce55 100644
--- a/frontend/discourse/app/components/nav-item.gjs
+++ b/frontend/discourse/app/components/nav-item.gjs
@@ -65,6 +65,8 @@ export default class NavItem extends Component {
this.router.currentRoute.params.field_name === this.args.routeParam
);
}
+
+ return this.router.isActive(this.args.route, this.args.routeParam);
}
return this.router.isActive(this.args.route);
diff --git a/plugins/discourse-chat-integration/spec/system/provider_nav_spec.rb b/plugins/discourse-chat-integration/spec/system/provider_nav_spec.rb
new file mode 100644
index 00000000000..263c3641e44
--- /dev/null
+++ b/plugins/discourse-chat-integration/spec/system/provider_nav_spec.rb
@@ -0,0 +1,27 @@
+# frozen_string_literal: true
+
+RSpec.describe "Provider navigation" do
+ fab!(:admin)
+
+ before do
+ SiteSetting.chat_integration_enabled = true
+ SiteSetting.chat_integration_telegram_enabled = true
+ SiteSetting.chat_integration_discord_enabled = true
+ sign_in(admin)
+ end
+
+ it "only marks the current provider's nav pill as active" do
+ visit("/admin/plugins/chat-integration/telegram")
+
+ expect(page).to have_css(
+ ".admin-controls-chat-providers li.active",
+ count: 1,
+ text: I18n.t("js.chat_integration.provider.telegram.title"),
+ )
+ expect(page).to have_css(
+ ".admin-controls-chat-providers li:not(.active)",
+ count: 1,
+ text: I18n.t("js.chat_integration.provider.discord.title"),
+ )
+ end
+end