A platform for community discussion. Free, open, simple.
FIX: prevents setPanel to also set separated mode (#23227)
Joffrey JAFFEUX46c7e47f507e
diff --git a/app/assets/javascripts/discourse/app/services/sidebar-state.js b/app/assets/javascripts/discourse/app/services/sidebar-state.jsindex 623b3409a63..9f71d131373 100644--- a/app/assets/javascripts/discourse/app/services/sidebar-state.js+++ b/app/assets/javascripts/discourse/app/services/sidebar-state.js@@ -24,7 +24,6 @@ export default class SidebarState extends Service {setPanel(name) {this.currentPanelKey = name;- this.setSeparatedMode();}get currentPanel() {diff --git a/app/assets/javascripts/discourse/tests/acceptance/sidebar-plugin-api-test.js b/app/assets/javascripts/discourse/tests/acceptance/sidebar-plugin-api-test.jsindex 2f9e69e2689..c0aeb54b1b7 100644--- a/app/assets/javascripts/discourse/tests/acceptance/sidebar-plugin-api-test.js+++ b/app/assets/javascripts/discourse/tests/acceptance/sidebar-plugin-api-test.js@@ -1014,6 +1014,7 @@ acceptance("Sidebar - Plugin API", function (needs) {"new-panel");api.setSidebarPanel("new-panel");+ api.setSeparatedSidebarMode();});await visit("/");diff --git a/plugins/chat/spec/system/separate_sidebar_mode_spec.rb b/plugins/chat/spec/system/separate_sidebar_mode_spec.rbindex a1b62e1462d..5881703a5f7 100644--- a/plugins/chat/spec/system/separate_sidebar_mode_spec.rb+++ b/plugins/chat/spec/system/separate_sidebar_mode_spec.rb@@ -124,19 +124,27 @@ RSpec.describe "Separate sidebar mode", type: :system doexpect(sidebar_component).to have_switch_button("chat")expect(header_component).to have_open_chat_button+ expect(sidebar_component).to have_section("Categories")expect(sidebar_component).to have_no_section("chat-channels")chat_page.open_from_headerexpect(sidebar_component).to have_no_switch_buttonexpect(header_component).to have_open_chat_button+ expect(sidebar_component).to have_section("Categories")expect(sidebar_component).to have_no_section("chat-channels")chat_drawer_page.closeexpect(sidebar_component).to have_switch_button("chat")expect(header_component).to have_open_chat_button+ expect(sidebar_component).to have_section("Categories")expect(sidebar_component).to have_no_section("chat-channels")++ sidebar_component.switch_to_chat++ expect(sidebar_component).to have_no_section("chat-channels")+ expect(sidebar_component).to have_section("Categories")endend@@ -164,6 +172,16 @@ RSpec.describe "Separate sidebar mode", type: :system doexpect(header_component).to have_open_chat_buttonexpect(sidebar_component).to have_no_section("chat-channels")expect(sidebar_component).to have_section("Categories")++ sidebar_component.switch_to_chat++ expect(sidebar_component).to have_section("chat-channels")+ expect(sidebar_component).to have_no_section("Categories")++ sidebar_component.switch_to_main++ expect(sidebar_component).to have_no_section("chat-channels")+ expect(sidebar_component).to have_section("Categories")endendend@@ -199,6 +217,11 @@ RSpec.describe "Separate sidebar mode", type: :system doexpect(header_component).to have_open_chat_buttonexpect(sidebar_component).to have_section("Categories")expect(sidebar_component).to have_section("chat-channels")++ sidebar_component.switch_to_chat++ expect(sidebar_component).to have_section("Categories")+ expect(sidebar_component).to have_section("chat-channels")endend@@ -226,6 +249,16 @@ RSpec.describe "Separate sidebar mode", type: :system doexpect(header_component).to have_open_chat_buttonexpect(sidebar_component).to have_section("chat-channels")expect(sidebar_component).to have_section("Categories")++ sidebar_component.switch_to_chat++ expect(sidebar_component).to have_section("chat-channels")+ expect(sidebar_component).to have_no_section("Categories")++ sidebar_component.switch_to_main++ expect(sidebar_component).to have_section("chat-channels")+ expect(sidebar_component).to have_section("Categories")endendenddiff --git a/spec/system/page_objects/components/navigation_menu/base.rb b/spec/system/page_objects/components/navigation_menu/base.rbindex 7eda232bc75..f78a3e39f4c 100644--- a/spec/system/page_objects/components/navigation_menu/base.rb+++ b/spec/system/page_objects/components/navigation_menu/base.rb@@ -34,6 +34,10 @@ module PageObjectsfind(".sidebar__panel-switch-button[data-key='chat']").clickend+ def switch_to_main+ find(".sidebar__panel-switch-button[data-key='main']").click+ end+def has_no_section?(name)has_no_css?(".sidebar-sections [data-section-name='#{name.parameterize}']")end