A platform for community discussion. Free, open, simple.
REVERT: Clear forced sidebar when leaving AI Bot from another panel (#37485)
Mark VanLandinghamf086d1dd1881
diff --git a/plugins/discourse-ai/assets/javascripts/discourse/services/ai-conversations-sidebar-manager.js b/plugins/discourse-ai/assets/javascripts/discourse/services/ai-conversations-sidebar-manager.jsindex 78c9a03f895..0bc7b25c617 100644--- a/plugins/discourse-ai/assets/javascripts/discourse/services/ai-conversations-sidebar-manager.js+++ b/plugins/discourse-ai/assets/javascripts/discourse/services/ai-conversations-sidebar-manager.js@@ -159,16 +159,12 @@ export default class AiConversationsSidebarManager extends Service {document.body.classList.remove("has-ai-conversations-sidebar");document.body.classList.remove("has-empty-ai-conversations-sidebar");- // Only reset panel if no other route has claimed the sidebar in its activate() hook+ // Only reset if no other route has claimed the sidebar in its activate() hookconst isStillAiPanel =this.sidebarState.currentPanel?.key === AI_CONVERSATIONS_PANEL;if (this.sidebarState.isForcingSidebar && isStillAiPanel) {this.sidebarState.setPanel(MAIN_PANEL);- }-- // Always clear the forcing flag when leaving AI conversations- if (this.sidebarState.isForcingSidebar) {this.sidebarState.isForcingSidebar = false;this.appEvents.trigger("discourse-ai:stop-forcing-conversations-sidebar");}diff --git a/plugins/discourse-ai/spec/system/ai_bot/ai_bot_sidebar_navigation_spec.rb b/plugins/discourse-ai/spec/system/ai_bot/ai_bot_sidebar_navigation_spec.rbindex c11fa080aec..c06356d463c 100644--- a/plugins/discourse-ai/spec/system/ai_bot/ai_bot_sidebar_navigation_spec.rb+++ b/plugins/discourse-ai/spec/system/ai_bot/ai_bot_sidebar_navigation_spec.rb@@ -41,26 +41,4 @@ RSpec.describe "AI Bot sidebar navigation" doexpect(page).to have_no_css(".sidebar-sections.ai-conversations-panel")expect(page).to have_no_css(".sidebar-sections.chat-panel")end-- context "with header dropdown navigation menu" do- before { SiteSetting.navigation_menu = "header dropdown" }-- it "clears forced sidebar when navigating from AI bot to chat and then away" do- chat_page.prefers_full_page-- ai_pm_homepage.visit-- expect(page).to have_css(".sidebar-sections.ai-conversations-panel")-- find(".chat-header-icon").click-- expect(page).to have_css(".channels-list")- expect(page).to have_no_css("#sidebar-section-content-categories")-- find("#site-logo").click-- expect(page).to have_no_css(".sidebar-sections")- expect(page).to have_no_css(".channels-list")- end- endend