A platform for community discussion. Free, open, simple.
FIX: adds chat-draw-expanded class to body (#28490)
Joffrey JAFFEUX842d2749a1f1
diff --git a/plugins/chat/assets/javascripts/discourse/components/chat-drawer.hbs b/plugins/chat/assets/javascripts/discourse/components/chat-drawer.hbsindex 8db0d03db6f..712f71fabf4 100644--- a/plugins/chat/assets/javascripts/discourse/components/chat-drawer.hbs+++ b/plugins/chat/assets/javascripts/discourse/components/chat-drawer.hbs@@ -1,3 +1,11 @@+{{#if this.chatStateManager.isDrawerActive}}+ {{bodyClass "chat-drawer-active"}}+{{/if}}++{{#if this.chatStateManager.isDrawerExpanded}}+ {{bodyClass "chat-drawer-expanded"}}+{{/if}}+{{#if this.chatStateManager.isDrawerActive}}<divdata-chat-channel-id={{this.chat.activeChannel.id}}diff --git a/plugins/chat/assets/javascripts/discourse/initializers/chat-setup.js b/plugins/chat/assets/javascripts/discourse/initializers/chat-setup.jsindex 0a7b2ebe6e3..35eab70329d 100644--- a/plugins/chat/assets/javascripts/discourse/initializers/chat-setup.js+++ b/plugins/chat/assets/javascripts/discourse/initializers/chat-setup.js@@ -157,14 +157,6 @@ export default {id: "chat",});- api.addChatDrawerStateCallback(({ isDrawerActive }) => {- if (isDrawerActive) {- document.body.classList.add("chat-drawer-active");- } else {- document.body.classList.remove("chat-drawer-active");- }- });-api.addAboutPageActivity("chat_messages", (periods) => {const count = periods["7_days"];if (count) {diff --git a/plugins/chat/spec/system/drawer_spec.rb b/plugins/chat/spec/system/drawer_spec.rbindex 052d39a9a4a..92d4c8ea65d 100644--- a/plugins/chat/spec/system/drawer_spec.rb+++ b/plugins/chat/spec/system/drawer_spec.rb@@ -112,11 +112,14 @@ RSpec.describe "Drawer", type: :system doit "collapses the drawer" dovisit("/")chat_page.open_from_header+expect(page).to have_selector(".chat-drawer.is-expanded")+ expect(page).to have_selector("body.chat-drawer-expanded")page.find(".c-navbar").clickexpect(page).to have_selector(".chat-drawer:not(.is-expanded)")+ expect(page).to have_selector("body:not(.chat-drawer-expanded)")endend