mirror of
https://github.com/discourse/discourse.git
synced 2025-06-06 13:06:56 +08:00
FIX: adds chat-draw-expanded class to body (#28490)
To achieve this, the code is now using bodyClass instead of relying on the addChatDrawerStateCallback`.
This commit is contained in:
@ -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}}
|
{{#if this.chatStateManager.isDrawerActive}}
|
||||||
<div
|
<div
|
||||||
data-chat-channel-id={{this.chat.activeChannel.id}}
|
data-chat-channel-id={{this.chat.activeChannel.id}}
|
||||||
|
@ -157,14 +157,6 @@ export default {
|
|||||||
id: "chat",
|
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) => {
|
api.addAboutPageActivity("chat_messages", (periods) => {
|
||||||
const count = periods["7_days"];
|
const count = periods["7_days"];
|
||||||
if (count) {
|
if (count) {
|
||||||
|
@ -112,11 +112,14 @@ RSpec.describe "Drawer", type: :system do
|
|||||||
it "collapses the drawer" do
|
it "collapses the drawer" do
|
||||||
visit("/")
|
visit("/")
|
||||||
chat_page.open_from_header
|
chat_page.open_from_header
|
||||||
|
|
||||||
expect(page).to have_selector(".chat-drawer.is-expanded")
|
expect(page).to have_selector(".chat-drawer.is-expanded")
|
||||||
|
expect(page).to have_selector("body.chat-drawer-expanded")
|
||||||
|
|
||||||
page.find(".c-navbar").click
|
page.find(".c-navbar").click
|
||||||
|
|
||||||
expect(page).to have_selector(".chat-drawer:not(.is-expanded)")
|
expect(page).to have_selector(".chat-drawer:not(.is-expanded)")
|
||||||
|
expect(page).to have_selector("body:not(.chat-drawer-expanded)")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user