A platform for community discussion. Free, open, simple.
FIX: Multiple channels marked active in sidebar (#21045)
Martin Brennan7ae716fa6950
diff --git a/plugins/chat/assets/javascripts/discourse/initializers/chat-sidebar.js b/plugins/chat/assets/javascripts/discourse/initializers/chat-sidebar.jsindex 17ee576d745..b1b6a84fb3b 100644--- a/plugins/chat/assets/javascripts/discourse/initializers/chat-sidebar.js+++ b/plugins/chat/assets/javascripts/discourse/initializers/chat-sidebar.js@@ -9,7 +9,6 @@ import { emojiUnescape } from "discourse/lib/text";import { decorateUsername } from "discourse/helpers/decorate-username-selector";import { until } from "discourse/lib/formatter";import { inject as service } from "@ember/service";-import { computed } from "@ember/object";export default {name: "chat-sidebar",@@ -196,7 +195,6 @@ export default {return this.channel.slugifiedTitle;}- @computed("chatService.activeChannel")get classNames() {const classes = [];diff --git a/plugins/chat/spec/system/navigation_spec.rb b/plugins/chat/spec/system/navigation_spec.rbindex 559c9a4c2e3..22640a9bb9b 100644--- a/plugins/chat/spec/system/navigation_spec.rb+++ b/plugins/chat/spec/system/navigation_spec.rb@@ -242,12 +242,29 @@ RSpec.describe "Navigation", type: :system, js: true doendcontext "when opening a channel in full page" do+ fab!(:other_user) { Fabricate(:user) }+ fab!(:dm_channel) { Fabricate(:direct_message_channel, users: [user, other_user]) }+it "activates the channel in the sidebar" dovisit("/chat/c/#{category_channel.slug}/#{category_channel.id}")expect(page).to have_css(".sidebar-section-link-#{category_channel.slug}.sidebar-section-link--active",)end++ it "does not have multiple channels marked active in the sidebar" do+ chat_page.visit_channel(dm_channel)+ expect(page).to have_css(+ ".sidebar-section-link-#{other_user.username}.sidebar-section-link--active",+ )++ page.find(".sidebar-section-link-#{category_channel.slug}").click+ expect(page).to have_css(+ ".sidebar-section-link-#{category_channel.slug}.sidebar-section-link--active",+ )++ expect(page).to have_css(".sidebar-section-link--active", count: 1)+ endendcontext "when going back to channel from channel settings in full page" do