- {{#if this.chatStateManager.isFullPage}}
+ {{#if this.chatStateManager.isFullPageActive}}
{{#each this.emojiReactions as |reaction|}}
{{/each}}
diff --git a/plugins/chat/assets/javascripts/discourse/templates/components/full-page-chat.hbs b/plugins/chat/assets/javascripts/discourse/templates/components/full-page-chat.hbs
index 72a3907e56f..93ec4f6e3d5 100644
--- a/plugins/chat/assets/javascripts/discourse/templates/components/full-page-chat.hbs
+++ b/plugins/chat/assets/javascripts/discourse/templates/components/full-page-chat.hbs
@@ -1,3 +1,3 @@
{{#if this.chat.activeChannel}}
-
+
{{/if}}
diff --git a/plugins/chat/assets/javascripts/discourse/templates/components/topic-chat-float.hbs b/plugins/chat/assets/javascripts/discourse/templates/components/topic-chat-float.hbs
deleted file mode 100644
index 2f3f5d81d4f..00000000000
--- a/plugins/chat/assets/javascripts/discourse/templates/components/topic-chat-float.hbs
+++ /dev/null
@@ -1,86 +0,0 @@
-
-
-
-
- {{#if this.expanded}}
-
- {{#if (and this.chatView this.chat.activeChannel)}}
-
- {{else if this.draftChannelView}}
-
- {{else}}
-
- {{/if}}
-
- {{/if}}
-
-
diff --git a/plugins/chat/assets/javascripts/discourse/widgets/chat-header-icon.js b/plugins/chat/assets/javascripts/discourse/widgets/chat-header-icon.js
index 39e1b768d38..a0c280a5d19 100644
--- a/plugins/chat/assets/javascripts/discourse/widgets/chat-header-icon.js
+++ b/plugins/chat/assets/javascripts/discourse/widgets/chat-header-icon.js
@@ -40,7 +40,10 @@ export default createWidget("header-chat-link", {
chatLinkHtml(indicatorNode) {
return h(
`a.icon${
- this.chatStateManager.isFullPage || this.chat.chatOpen ? ".active" : ""
+ this.chatStateManager.isFullPageActive ||
+ this.chatStateManager.isDrawerActive
+ ? ".active"
+ : ""
}`,
{ attributes: { tabindex: 0 } },
[iconNode("comment"), indicatorNode].filter(Boolean)
@@ -61,7 +64,7 @@ export default createWidget("header-chat-link", {
},
click() {
- if (this.chatStateManager.isFullPage && !this.site.mobileView) {
+ if (this.chatStateManager.isFullPageActive && !this.site.mobileView) {
return;
}
diff --git a/plugins/chat/assets/stylesheets/common/chat-channel-title.scss b/plugins/chat/assets/stylesheets/common/chat-channel-title.scss
index f5043f4d799..4eac8df3c18 100644
--- a/plugins/chat/assets/stylesheets/common/chat-channel-title.scss
+++ b/plugins/chat/assets/stylesheets/common/chat-channel-title.scss
@@ -21,8 +21,6 @@
.chat-name,
.category-chat-name,
- .topic-chat-name,
- .tag-chat-name,
&__usernames,
.dm-usernames {
@include ellipsis;
diff --git a/plugins/chat/assets/stylesheets/common/chat-drawer.scss b/plugins/chat/assets/stylesheets/common/chat-drawer.scss
index e996f96790e..5587c49955a 100644
--- a/plugins/chat/assets/stylesheets/common/chat-drawer.scss
+++ b/plugins/chat/assets/stylesheets/common/chat-drawer.scss
@@ -1,8 +1,8 @@
-body.composer-open .topic-chat-float-container {
+body.composer-open .chat-drawer-outlet-container {
bottom: 11px; // prevent height of grippie from obscuring ...is typing indicator
}
-.topic-chat-float-container {
+.chat-drawer-outlet-container {
font-family: "Lato", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
// higher than timeline, lower than composer, lower than user card (bump up below)
@@ -60,22 +60,24 @@ body.composer-open .topic-chat-float-container {
.chat-drawer {
align-self: flex-end;
-}
-.topic-chat-container {
- background: var(--secondary);
- border: 1px solid var(--primary-low);
- border-bottom: 0;
- border-top-left-radius: 8px;
- border-top-right-radius: 8px;
- box-shadow: 0px 0px 4px rgba(0, 0, 0, 0.125);
- box-sizing: border-box;
- display: flex;
- flex-direction: column;
+ .chat-drawer-container {
+ background: var(--secondary);
+ border: 1px solid var(--primary-low);
+ border-bottom: 0;
+ border-top-left-radius: 8px;
+ border-top-right-radius: 8px;
+ box-shadow: 0px 0px 4px rgba(0, 0, 0, 0.125);
+ box-sizing: border-box;
+ display: flex;
+ flex-direction: column;
+ }
- &.expanded {
- max-height: $float-height;
- height: calc(85vh - var(--composer-height, 0px));
+ &.is-expanded {
+ .chat-drawer-container {
+ max-height: $float-height;
+ height: calc(85vh - var(--composer-height, 0px));
+ }
}
.chat-live-pane {
@@ -83,30 +85,30 @@ body.composer-open .topic-chat-float-container {
}
}
-.topic-chat-drawer-header__left-actions {
+.chat-drawer-header__left-actions {
display: flex;
height: 100%;
}
-.topic-chat-drawer-header__right-actions {
+.chat-drawer-header__right-actions {
display: flex;
height: 100%;
margin-left: auto;
}
-.topic-chat-drawer-header__top-line {
+.chat-drawer-header__top-line {
height: 2.5rem;
display: flex;
align-items: center;
}
-.topic-chat-drawer-header__bottom-line {
+.chat-drawer-header__bottom-line {
height: 1.5rem;
display: flex;
align-items: start;
}
-.topic-chat-drawer-header__title {
+.chat-drawer-header__title {
@include ellipsis;
display: flex;
flex-direction: column;
@@ -120,7 +122,7 @@ body.composer-open .topic-chat-float-container {
}
}
-.topic-chat-drawer-header {
+.chat-drawer-header {
box-sizing: border-box;
border-bottom: solid 1px var(--primary-low);
border-radius: 8px 8px 0 0;
@@ -138,13 +140,13 @@ body.composer-open .topic-chat-float-container {
width: 100%;
.chat-name,
- .topic-chat-name,
+ .chat-drawer-name,
.category-chat-name,
.dm-usernames {
color: var(--primary);
}
.category-chat-badge,
- .topic-chat-badge {
+ .chat-drawer-badge {
display: flex;
justify-content: center;
align-content: center;
@@ -213,7 +215,7 @@ body.composer-open .topic-chat-float-container {
}
}
-.topic-chat-drawer-content {
+.chat-drawer-content {
box-sizing: border-box;
height: 100%;
min-height: 1px;
diff --git a/plugins/chat/assets/stylesheets/common/chat-message.scss b/plugins/chat/assets/stylesheets/common/chat-message.scss
index 221141585ed..2ca098e21bf 100644
--- a/plugins/chat/assets/stylesheets/common/chat-message.scss
+++ b/plugins/chat/assets/stylesheets/common/chat-message.scss
@@ -288,7 +288,7 @@
}
.has-full-page-chat .chat-message .onebox:not(img),
-.topic-chat-float-container .chat-message .onebox {
+.chat-drawer-container .chat-message .onebox {
margin: 0.5em 0;
border-width: 2px;
@@ -311,7 +311,7 @@
}
}
-.topic-chat-float-container .chat-message .onebox {
+.chat-drawer-container .chat-message .onebox {
width: 85%;
border: 2px solid var(--primary-low);
diff --git a/plugins/chat/assets/stylesheets/common/chat-selection-manager.scss b/plugins/chat/assets/stylesheets/common/chat-selection-manager.scss
index 2349f67e102..959fad11334 100644
--- a/plugins/chat/assets/stylesheets/common/chat-selection-manager.scss
+++ b/plugins/chat/assets/stylesheets/common/chat-selection-manager.scss
@@ -4,7 +4,7 @@
gap: 0.5rem;
padding: 0.5rem;
- .topic-chat-drawer-content & {
+ .chat-drawer-content & {
flex-direction: column;
}
@@ -12,7 +12,7 @@
display: flex;
gap: 0.5rem;
- .topic-chat-drawer-content & {
+ .chat-drawer-content & {
flex-direction: column;
width: 100%;
}
diff --git a/plugins/chat/assets/stylesheets/common/common.scss b/plugins/chat/assets/stylesheets/common/common.scss
index 7fcb259506f..1610f814474 100644
--- a/plugins/chat/assets/stylesheets/common/common.scss
+++ b/plugins/chat/assets/stylesheets/common/common.scss
@@ -471,9 +471,6 @@ $float-height: 530px;
&:hover,
&.active {
- .topic-chat-badge .topic-chat-icon .d-icon {
- background: transparent;
- }
&.active {
font-weight: 600;
}
@@ -632,8 +629,6 @@ body.has-full-page-chat {
background-color: var(--primary-low);
.chat-channel-title {
.category-chat-name,
- .topic-chat-name,
- .tag-chat-name,
.chat-name,
.dm-usernames {
color: var(--primary);
@@ -664,8 +659,6 @@ body.has-full-page-chat {
.chat-channel-title {
.category-chat-name,
- .topic-chat-name,
- .tag-chat-name,
.chat-name,
.dm-usernames {
color: var(--primary);
@@ -735,8 +728,7 @@ body.has-full-page-chat {
}
.category-chat-name,
- .dm-username,
- .topic-chat-name {
+ .dm-username {
font-weight: 700;
font-size: var(--font-up-1);
line-height: var(--font-up-1);
@@ -754,9 +746,7 @@ body.has-full-page-chat {
}
.channels-list {
- .tag-chat-badge,
- .category-chat-badge,
- .topic-chat-badge {
+ .category-chat-badge {
color: var(--primary-low-mid);
display: flex;
align-items: center;
@@ -769,12 +759,6 @@ body.has-full-page-chat {
}
}
- .topic-chat-badge {
- .d-icon {
- z-index: 1;
- }
- }
-
.category-chat-private .d-icon {
background-color: var(--secondary);
position: absolute;
diff --git a/plugins/chat/spec/system/navigation_spec.rb b/plugins/chat/spec/system/navigation_spec.rb
index e487ecb1f8a..3a4ee506fe9 100644
--- a/plugins/chat/spec/system/navigation_spec.rb
+++ b/plugins/chat/spec/system/navigation_spec.rb
@@ -34,7 +34,7 @@ RSpec.describe "Navigation", type: :system, js: true do
visit("/")
chat_page.open_from_header
- expect(page).to have_css(".topic-chat-container.expanded.visible")
+ expect(page).to have_css(".chat-drawer.is-expanded")
end
end
@@ -62,12 +62,12 @@ RSpec.describe "Navigation", type: :system, js: true do
chat_page.open
chat_page.minimize_full_page
- expect(page).to have_css(".topic-chat-container.expanded.visible")
+ expect(page).to have_css(".chat-drawer.is-expanded")
visit("/")
chat_page.open_from_header
- expect(page).to have_css(".topic-chat-container.expanded.visible")
+ expect(page).to have_css(".chat-drawer.is-expanded")
end
end
@@ -114,7 +114,7 @@ RSpec.describe "Navigation", type: :system, js: true do
find("a", text: "foo").click
expect(page).to have_css(
- ".topic-chat-container.expanded.visible .chat-message-container.highlighted[data-id='#{message.id}']",
+ ".chat-drawer.is-expanded .chat-message-container.highlighted[data-id='#{message.id}']",
)
end
end
@@ -156,7 +156,7 @@ RSpec.describe "Navigation", type: :system, js: true do
sidebar_page.open_draft_channel
expect(page).to have_current_path("/")
- expect(page).to have_css(".topic-chat-container.expanded.visible .direct-message-creator")
+ expect(page).to have_css(".chat-drawer.is-expanded .direct-message-creator")
end
end
@@ -167,7 +167,7 @@ RSpec.describe "Navigation", type: :system, js: true do
chat_drawer_page.open_draft_channel
expect(page).to have_current_path("/")
- expect(page).to have_css(".topic-chat-container.expanded.visible .direct-message-creator")
+ expect(page).to have_css(".chat-drawer.is-expanded .direct-message-creator")
end
end
@@ -180,7 +180,7 @@ RSpec.describe "Navigation", type: :system, js: true do
sidebar_page.open_draft_channel
expect(page).to have_current_path("/chat/draft-channel")
- expect(page).not_to have_css(".topic-chat-container.expanded.visible")
+ expect(page).not_to have_css(".chat-drawer.is-expanded")
end
end
@@ -191,7 +191,7 @@ RSpec.describe "Navigation", type: :system, js: true do
chat_drawer_page.open_browse
expect(page).to have_current_path("/chat/browse/open")
- expect(page).not_to have_css(".topic-chat-container.expanded.visible")
+ expect(page).not_to have_css(".chat-drawer.is-expanded")
end
end
@@ -202,7 +202,7 @@ RSpec.describe "Navigation", type: :system, js: true do
sidebar_page.open_browse
expect(page).to have_current_path("/chat/browse/open")
- expect(page).not_to have_css(".topic-chat-container.expanded.visible")
+ expect(page).not_to have_css(".chat-drawer.is-expanded")
end
end
@@ -216,7 +216,7 @@ RSpec.describe "Navigation", type: :system, js: true do
chat_page.open_from_header
expect(page).to have_current_path("/")
- expect(page).to have_css(".topic-chat-container.expanded.visible")
+ expect(page).to have_css(".chat-drawer.is-expanded")
expect(page).to have_content(category_channel_2.title)
end
end
diff --git a/plugins/chat/spec/system/page_objects/chat_drawer/chat_drawer.rb b/plugins/chat/spec/system/page_objects/chat_drawer/chat_drawer.rb
index 5e2cae079d7..1fa4d9fcf2a 100644
--- a/plugins/chat/spec/system/page_objects/chat_drawer/chat_drawer.rb
+++ b/plugins/chat/spec/system/page_objects/chat_drawer/chat_drawer.rb
@@ -3,7 +3,7 @@
module PageObjects
module Pages
class ChatDrawer < PageObjects::Pages::Base
- VISIBLE_DRAWER = ".topic-chat-container.expanded.visible"
+ VISIBLE_DRAWER = ".chat-drawer.is-expanded"
def open_browse
find("#{VISIBLE_DRAWER} .open-browse-page-btn").click
end
@@ -13,11 +13,11 @@ module PageObjects
end
def close
- find("#{VISIBLE_DRAWER} .topic-chat-drawer-header__close-btn").click
+ find("#{VISIBLE_DRAWER} .chat-drawer-header__close-btn").click
end
def open_index
- find("#{VISIBLE_DRAWER} .topic-chat-drawer-header__return-to-channels-btn").click
+ find("#{VISIBLE_DRAWER} .chat-drawer-header__return-to-channels-btn").click
end
def open_channel(channel)
@@ -27,7 +27,7 @@ module PageObjects
end
def maximize
- find("#{VISIBLE_DRAWER} .topic-chat-drawer-header__full-screen-btn").click
+ find("#{VISIBLE_DRAWER} .chat-drawer-header__full-screen-btn").click
end
end
end
diff --git a/plugins/chat/spec/system/shortcuts/drawer_spec.rb b/plugins/chat/spec/system/shortcuts/drawer_spec.rb
new file mode 100644
index 00000000000..84f25675aa8
--- /dev/null
+++ b/plugins/chat/spec/system/shortcuts/drawer_spec.rb
@@ -0,0 +1,44 @@
+# frozen_string_literal: true
+
+RSpec.describe "Navigation", type: :system, js: true do
+ fab!(:user_1) { Fabricate(:admin) }
+ fab!(:category_channel_1) { Fabricate(:category_channel) }
+ fab!(:category_channel_2) { Fabricate(:category_channel) }
+ let(:chat_page) { PageObjects::Pages::Chat.new }
+ let(:chat_drawer_page) { PageObjects::Pages::ChatDrawer.new }
+
+ before do
+ chat_system_bootstrap(user_1, [category_channel_1, category_channel_2])
+ sign_in(user_1)
+ end
+
+ context "when drawer is closed" do
+ before { visit("/") }
+
+ context "when pressing dash" do
+ it "opens the drawer" do
+ find("body").send_keys("-")
+
+ expect(page).to have_css(".chat-drawer.is-expanded")
+ end
+ end
+ end
+
+ context "when drawer is opened" do
+ before do
+ visit("/")
+ chat_page.open_from_header
+ end
+
+ context "when pressing escape" do
+ it "opens the drawer" do
+ expect(page).to have_css(".chat-drawer.is-expanded")
+
+ chat_drawer_page.open_channel(category_channel_1)
+ find(".chat-composer-input").send_keys(:escape)
+
+ expect(page).to_not have_css(".chat-drawer.is-expanded")
+ end
+ end
+ end
+end
diff --git a/plugins/chat/test/javascripts/acceptance/chat-channels-list-test.js b/plugins/chat/test/javascripts/acceptance/chat-channels-list-test.js
index ec7ed3a1b3b..4646aaa446c 100644
--- a/plugins/chat/test/javascripts/acceptance/chat-channels-list-test.js
+++ b/plugins/chat/test/javascripts/acceptance/chat-channels-list-test.js
@@ -15,6 +15,8 @@ acceptance(
needs.settings({
chat_enabled: true,
+ enable_sidebar: false,
+ enable_experimental_sidebar_hamburger: false,
});
needs.pretender((server, helper) => {
diff --git a/plugins/chat/test/javascripts/acceptance/chat-composer-test.js b/plugins/chat/test/javascripts/acceptance/chat-composer-test.js
index 4fd59c33341..ebe8af08dc6 100644
--- a/plugins/chat/test/javascripts/acceptance/chat-composer-test.js
+++ b/plugins/chat/test/javascripts/acceptance/chat-composer-test.js
@@ -18,7 +18,7 @@ import {
} from "../helpers/chat-pretenders";
acceptance("Discourse Chat - Composer", function (needs) {
- needs.user({ id: 1, has_chat_enabled: true });
+ needs.user({ has_chat_enabled: true });
needs.settings({ chat_enabled: true, enable_rich_text_paste: true });
needs.pretender((server, helper) => {
baseChatPretenders(server, helper);
diff --git a/plugins/chat/test/javascripts/acceptance/chat-keyboard-shortcuts-test.js b/plugins/chat/test/javascripts/acceptance/chat-keyboard-shortcuts-test.js
index cde51fdd3ba..9c18a32ffa9 100644
--- a/plugins/chat/test/javascripts/acceptance/chat-keyboard-shortcuts-test.js
+++ b/plugins/chat/test/javascripts/acceptance/chat-keyboard-shortcuts-test.js
@@ -5,7 +5,6 @@ import {
loggedInUser,
query,
queryAll,
- visible,
} from "discourse/tests/helpers/qunit-helpers";
import {
click,
@@ -84,9 +83,9 @@ acceptance("Discourse Chat - Keyboard shortcuts", function (needs) {
test("channel selector opens channel in float", async function (assert) {
await visit("/latest");
-
await showModal("chat-channel-selector-modal");
await settled();
+
assert.ok(exists("#chat-channel-selector-modal-inner"));
// All channels should show because the input is blank
@@ -110,7 +109,8 @@ acceptance("Discourse Chat - Keyboard shortcuts", function (needs) {
);
await triggerKeyEvent(document.body, "keyup", "Enter");
- assert.ok(exists(".topic-chat-container.visible"));
+
+ assert.ok(exists(".chat-drawer.is-expanded"));
assert.notOk(exists("#chat-channel-selector-modal-inner"));
assert.equal(currentURL(), "/latest");
});
@@ -164,28 +164,24 @@ acceptance("Discourse Chat - Keyboard shortcuts", function (needs) {
test("switching channel with alt+arrow keys in float", async function (assert) {
await visit("/latest");
- this.chatService.set("sidebarActive", false);
-
await click(".header-dropdown-toggle.open-chat");
await click("#chat-channel-row-4");
- assert.ok(visible(".topic-chat-float-container"), "chat float is open");
- assert.ok(query(".topic-chat-container").classList.contains("channel-4"));
+ assert.ok(exists(`.chat-drawer.is-expanded[data-chat-channel-id="4"]`));
await triggerKeyEvent(document.body, "keydown", "ArrowDown", {
altKey: true,
});
- assert.ok(query(".topic-chat-container").classList.contains("channel-10"));
+ assert.ok(exists(`.chat-drawer.is-expanded[data-chat-channel-id="10`));
await triggerKeyEvent(document.body, "keydown", "ArrowUp", {
altKey: true,
});
- assert.ok(query(".topic-chat-container").classList.contains("channel-4"));
+ assert.ok(exists(`.chat-drawer.is-expanded[data-chat-channel-id="4"]`));
});
test("simple composer formatting shortcuts", async function (assert) {
- this.chatService.set("sidebarActive", false);
await visit("/latest");
await click(".header-dropdown-toggle.open-chat");
await click(".chat-channel-row");
@@ -230,7 +226,6 @@ acceptance("Discourse Chat - Keyboard shortcuts", function (needs) {
const stagedMessageText = "This is a test";
await visit("/latest");
- this.chatService.set("sidebarActive", false);
await click(".header-dropdown-toggle.open-chat");
await click(".chat-channel-row");
await fillIn(".chat-composer-input", stagedMessageText);
@@ -246,7 +241,6 @@ acceptance("Discourse Chat - Keyboard shortcuts", function (needs) {
test("insert link shortcut", async function (assert) {
await visit("/latest");
- this.chatService.set("sidebarActive", false);
await click(".header-dropdown-toggle.open-chat");
await click(".chat-channel-row");
@@ -276,32 +270,7 @@ acceptance("Discourse Chat - Keyboard shortcuts", function (needs) {
);
});
- test("Dash key (-) opens chat float", async function (assert) {
- await visit("/latest");
- this.chatService.set("sidebarActive", false);
-
- await triggerKeyEvent(document.body, "keydown", "-");
- assert.ok(exists(".topic-chat-drawer-content"), "chat float is open");
- });
-
- test("Pressing Escape when drawer is opened", async function (assert) {
- this.chatService.set("sidebarActive", false);
- await visit("/latest");
- await click(".header-dropdown-toggle.open-chat");
- await click(".chat-channel-row");
-
- const composerInput = query(".chat-composer-input");
- await focus(composerInput);
- await triggerKeyEvent(composerInput, "keydown", "Escape");
-
- assert.ok(
- exists(".topic-chat-float-container.hidden"),
- "it closes the drawer"
- );
- });
-
test("Pressing Escape when full page is opened", async function (assert) {
- this.chatService.set("sidebarActive", false);
await visit("/chat/channel/75/@hawk");
const composerInput = query(".chat-composer-input");
await focus(composerInput);
diff --git a/plugins/chat/test/javascripts/acceptance/chat-quoting-test.js b/plugins/chat/test/javascripts/acceptance/chat-quoting-test.js
index 1a9fe0c3426..63569a12ad0 100644
--- a/plugins/chat/test/javascripts/acceptance/chat-quoting-test.js
+++ b/plugins/chat/test/javascripts/acceptance/chat-quoting-test.js
@@ -110,7 +110,7 @@ acceptance("Discourse Chat | Quoting in composer", async function (needs) {
await visit("/t/internationalization-localization/280");
await click(".header-dropdown-toggle.open-chat");
- assert.ok(visible(".topic-chat-float-container"), "chat float is open");
+ assert.ok(visible(".chat-drawer-container"), "chat drawer is open");
assert.ok(exists(".chat-message-container"));
const firstMessage = query(".chat-message-container");
diff --git a/plugins/chat/test/javascripts/acceptance/chat-status-test.js b/plugins/chat/test/javascripts/acceptance/chat-status-test.js
index 3b3e13274f3..4ba11d24d9e 100644
--- a/plugins/chat/test/javascripts/acceptance/chat-status-test.js
+++ b/plugins/chat/test/javascripts/acceptance/chat-status-test.js
@@ -61,6 +61,7 @@ acceptance(
needs.settings({
chat_enabled: true,
chat_allow_archiving_channels: true,
+ enable_sidebar: false,
});
needs.pretender((server, helper) => {
diff --git a/plugins/chat/test/javascripts/acceptance/chat-test.js b/plugins/chat/test/javascripts/acceptance/chat-test.js
index d1f6e5346fb..ee1093255fa 100644
--- a/plugins/chat/test/javascripts/acceptance/chat-test.js
+++ b/plugins/chat/test/javascripts/acceptance/chat-test.js
@@ -65,6 +65,7 @@ acceptance("Discourse Chat - without unread", function (needs) {
has_chat_enabled: true,
});
needs.settings({
+ enable_sidebar: false,
chat_enabled: true,
});
needs.pretender((server, helper) => {
@@ -144,8 +145,8 @@ acceptance("Discourse Chat - without unread", function (needs) {
await visit("/t/internationalization-localization/280");
await click(".header-dropdown-toggle.current-user");
await click("#quick-access-notifications .chat-mention");
- assert.ok(visible(".topic-chat-float-container"), "chat float is open");
- assert.ok(query(".topic-chat-container").classList.contains("channel-9"));
+ assert.ok(visible(".chat-drawer-container"), "drawer is open");
+ assert.ok(query(".chat-drawer-container").classList.contains("channel-9"));
});
test("notifications for current user and here/all are highlighted", async function (assert) {
@@ -366,20 +367,18 @@ acceptance("Discourse Chat - without unread", function (needs) {
});
test("Reply-to is stored in draft", async function (assert) {
- this.chatService.set("sidebarActive", false);
-
await visit("/latest");
await click(".header-dropdown-toggle.open-chat");
await click(".chat-channel-row");
await settled();
- await click(".topic-chat-drawer-header__return-to-channels-btn");
+ await click(".chat-drawer-header__return-to-channels-btn");
await click(".chat-channel-row.chat-channel-9");
await triggerEvent(".chat-message-container[data-id='174']", "mouseenter");
await click(".chat-message-actions-container[data-id='174'] .reply-btn");
// Reply-to line is present
assert.ok(exists(".chat-composer-message-details .chat-reply"));
- await click(".topic-chat-drawer-header__return-to-channels-btn");
+ await click(".chat-drawer-header__return-to-channels-btn");
await click(".chat-channel-row.chat-channel-11");
// Reply-to line is gone since switching channels
assert.notOk(exists(".chat-composer-message-details .chat-reply"));
@@ -390,13 +389,13 @@ acceptance("Discourse Chat - without unread", function (needs) {
await click(".cancel-message-action");
// Go back to channel 9 and check that reply-to is present
- await click(".topic-chat-drawer-header__return-to-channels-btn");
+ await click(".chat-drawer-header__return-to-channels-btn");
await click(".chat-channel-row.chat-channel-9");
// Now reply-to should be back and loaded from draft
assert.ok(exists(".chat-composer-message-details .chat-reply"));
// Go back one for time to channel 7 and make sure reply-to is gone
- await click(".topic-chat-drawer-header__return-to-channels-btn");
+ await click(".chat-drawer-header__return-to-channels-btn");
await click(".chat-channel-row.chat-channel-11");
assert.notOk(exists(".chat-composer-message-details .chat-reply"));
});
@@ -725,7 +724,7 @@ Widget.triangulate(arg: "test")
});
test("creating a new direct message channel from popup chat works", async function (assert) {
- await visit("/t/internationalization-localization/280");
+ await visit("/chat");
await click(".open-draft-channel-page-btn");
await fillIn(".filter-usernames", "hawk");
await click('.chat-user-avatar-container[data-user-card="hawk"]');
@@ -978,9 +977,8 @@ acceptance(
test("Expand button takes you to full page chat on the correct channel", async function (assert) {
await visit("/t/internationalization-localization/280");
- this.chatService.set("sidebarActive", false);
await click(".header-dropdown-toggle.open-chat");
- await click(".topic-chat-drawer-header__full-screen-btn");
+ await click(".chat-drawer-header__full-screen-btn");
assert.equal(currentURL(), `/chat/channel/11/another-category`);
});
@@ -1032,7 +1030,7 @@ acceptance(
);
acceptance(
- "Discourse Chat - Expand and collapse chat drawer (topic-chat-float)",
+ "Discourse Chat - Expand and collapse drawer (chat-drawer)",
function (needs) {
needs.user({
admin: false,
@@ -1061,62 +1059,59 @@ acceptance(
});
});
- test("chat drawer can be collapsed and expanded", async function (assert) {
+ test("drawer can be collapsed and expanded", async function (assert) {
await visit("/t/internationalization-localization/280");
- this.chatService.set("sidebarActive", false);
await click(".header-dropdown-toggle.open-chat");
assert.ok(
- visible(".topic-chat-drawer-header__top-line--expanded"),
- "chat float is expanded"
+ visible(".chat-drawer-header__top-line--expanded"),
+ "drawer is expanded"
);
- await click(".topic-chat-drawer-header__expand-btn");
+ await click(".chat-drawer-header__expand-btn");
assert.ok(
- visible(".topic-chat-drawer-header__top-line--collapsed"),
- "chat float is collapsed"
+ visible(".chat-drawer-header__top-line--collapsed"),
+ "drawer is collapsed"
);
- await click(".topic-chat-drawer-header__expand-btn");
+ await click(".chat-drawer-header__expand-btn");
assert.ok(
- visible(".topic-chat-drawer-header__top-line--expanded"),
- "chat float is expanded"
+ visible(".chat-drawer-header__top-line--expanded"),
+ "drawer is expanded"
);
});
- test("chat drawer title links to channel info when expanded", async function (assert) {
+ test("drawer title links to channel info when expanded", async function (assert) {
await visit("/t/internationalization-localization/280");
- this.chatService.set("sidebarActive", false);
await click(".header-dropdown-toggle.open-chat");
assert.ok(
- visible(".topic-chat-drawer-header__top-line--expanded"),
- "chat float is expanded"
+ visible(".chat-drawer-header__top-line--expanded"),
+ "drawer is expanded"
);
await click("#chat-channel-row-9");
- await click(".topic-chat-drawer-header__title");
+ await click(".chat-drawer-header__title");
assert.equal(currentURL(), `/chat/channel/9/site/info/members`);
});
- test("chat drawer title expands the chat drawer when collapsed", async function (assert) {
+ test("drawer title expands the drawer when collapsed", async function (assert) {
await visit("/t/internationalization-localization/280");
- this.chatService.set("sidebarActive", false);
await click(".header-dropdown-toggle.open-chat");
await click(".chat-channel-row");
assert.ok(
- visible(".topic-chat-drawer-header__top-line--expanded"),
- "chat float is expanded"
+ visible(".chat-drawer-header__top-line--expanded"),
+ "drawer is expanded"
);
- await click(".topic-chat-drawer-header__expand-btn");
+ await click(".chat-drawer-header__expand-btn");
assert.ok(
- visible(".topic-chat-drawer-header__top-line--collapsed"),
- "chat float is collapsed"
+ visible(".chat-drawer-header__top-line--collapsed"),
+ "drawer is collapsed"
);
- await click(".topic-chat-drawer-header__title");
+ await click(".chat-drawer-header__title");
assert.ok(
- visible(".topic-chat-drawer-header__top-line--expanded"),
- "chat float is expanded"
+ visible(".chat-drawer-header__top-line--expanded"),
+ "drawer is expanded"
);
});
}
@@ -1164,14 +1159,12 @@ acceptance(
);
});
- test("Chat float open to DM channel with unread messages with sidebar off", async function (assert) {
+ test("drawer open to DM channel with unread messages with sidebar off", async function (assert) {
await visit("/t/internationalization-localization/280");
- this.chatService.set("sidebarActive", false);
-
await click(".header-dropdown-toggle.open-chat");
await click("#chat-channel-row-75");
- const chatContainer = query(".topic-chat-container");
- assert.ok(chatContainer.classList.contains("channel-75"));
+ const chatContainer = query(".chat-drawer");
+ assert.strictEqual(chatContainer.dataset.chatChannelId, "75");
});
test("Chat full page open to DM channel with unread messages with sidebar on", async function (assert) {
@@ -1400,10 +1393,10 @@ acceptance("Discourse Chat - image uploads", function (needs) {
test("uploading files in chat works", async function (assert) {
await visit("/t/internationalization-localization/280");
- this.container.lookup("service:chat").set("sidebarActive", false);
await click(".header-dropdown-toggle.open-chat");
+ await click(".chat-channel-row");
- assert.ok(visible(".topic-chat-float-container"), "chat float is open");
+ assert.ok(exists(".chat-drawer.is-expanded"), "drawer is open");
const appEvents = loggedInUser().appEvents;
const done = assert.async();
@@ -1462,7 +1455,7 @@ acceptance("Discourse Chat - image uploads", function (needs) {
this.container.lookup("service:chat").set("sidebarActive", false);
await click(".header-dropdown-toggle.open-chat");
await click(".chat-channel-row");
- assert.ok(visible(".topic-chat-float-container"), "chat float is open");
+ assert.ok(visible(".chat-drawer-container"), "drawer is open");
const appEvents = loggedInUser().appEvents;
const done = assert.async();
@@ -1811,34 +1804,6 @@ acceptance("Discourse Chat - Direct Message Creator", function (needs) {
});
});
-acceptance("Discourse Chat - Drawer", function (needs) {
- needs.user({ has_chat_enabled: true });
- needs.settings({ chat_enabled: true });
- needs.pretender((server, helper) => {
- baseChatPretenders(server, helper);
- chatChannelPretender(server, helper);
- });
-
- needs.hooks.beforeEach(function () {
- Object.defineProperty(this, "chatService", {
- get: () => this.container.lookup("service:chat"),
- });
- });
-
- test("Position after closing reduced composer", async function (assert) {
- await visit("/t/internationalization-localization/280");
- await click(".btn.create");
- await click(".toggle-preview");
- await click(".header-dropdown-toggle.open-chat");
- await click(".save-or-cancel .cancel");
- const float = document.querySelector(".topic-chat-float-container");
- const key = "--composer-right";
- const value = getComputedStyle(float).getPropertyValue(key);
-
- assert.strictEqual(value, "15px");
- });
-});
-
function createFile(name, type = "image/png") {
// the blob content doesn't matter at all, just want it to be random-ish
const file = new Blob([(Math.random() + 1).toString(36).substring(2)], {
diff --git a/plugins/chat/test/javascripts/acceptance/core-sidebar-test.js b/plugins/chat/test/javascripts/acceptance/core-sidebar-test.js
index 87ffc59ffdc..ea3381104ea 100644
--- a/plugins/chat/test/javascripts/acceptance/core-sidebar-test.js
+++ b/plugins/chat/test/javascripts/acceptance/core-sidebar-test.js
@@ -418,7 +418,7 @@ acceptance("Discourse Chat - Core Sidebar", function (needs) {
await click(".sidebar-section-chat-dms .sidebar-section-header-button");
assert.ok(exists(".direct-message-creator"));
- assert.ok(exists(".topic-chat-container.expanded.visible"));
+ assert.ok(exists(".chat-drawer.is-expanded"));
assert.strictEqual(currentURL(), "/");
});
diff --git a/plugins/chat/test/javascripts/acceptance/user-card-chat-test.js b/plugins/chat/test/javascripts/acceptance/user-card-chat-test.js
index a4750fea4e4..035bd8d1416 100644
--- a/plugins/chat/test/javascripts/acceptance/user-card-chat-test.js
+++ b/plugins/chat/test/javascripts/acceptance/user-card-chat-test.js
@@ -4,8 +4,6 @@ import {
acceptance,
exists,
loggedInUser,
- query,
- visible,
} from "discourse/tests/helpers/qunit-helpers";
import { click, visit } from "@ember/test-helpers";
import {
@@ -82,7 +80,6 @@ acceptance("Discourse Chat - User card test", function (needs) {
});
test("user card has chat button that opens the correct channel", async function (assert) {
- this.chatService.set("sidebarActive", false);
await visit("/");
await click(".header-dropdown-toggle.open-chat");
await click(".chat-channel-row.chat-channel-9");
@@ -92,8 +89,7 @@ acceptance("Discourse Chat - User card test", function (needs) {
await click(".user-card-chat-btn");
- assert.ok(visible(".topic-chat-float-container"), "chat float is open");
- assert.ok(query(".topic-chat-container").classList.contains("channel-75"));
+ assert.ok(exists(`.chat-drawer.is-expanded[data-chat-channel-id="75"]`));
});
});
diff --git a/plugins/chat/test/javascripts/components/sidebar-channels-test.js b/plugins/chat/test/javascripts/components/sidebar-channels-test.js
index 053c662cfd6..52b4ee61f95 100644
--- a/plugins/chat/test/javascripts/components/sidebar-channels-test.js
+++ b/plugins/chat/test/javascripts/components/sidebar-channels-test.js
@@ -32,7 +32,7 @@ module("Discourse Chat | Component | sidebar-channels", function (hooks) {
template: hbs`{{sidebar-channels}}`,
beforeEach() {
- setupChatStub(this, { fullScreenChatOpen: true });
+ setupChatStub(this, {});
},
afterEach() {
@@ -48,7 +48,7 @@ module("Discourse Chat | Component | sidebar-channels", function (hooks) {
template: hbs`{{sidebar-channels}}`,
beforeEach() {
- setupChatStub(this, { userCanChat: false, fullScreenChatOpen: false });
+ setupChatStub(this, { userCanChat: false });
},
afterEach() {
diff --git a/plugins/chat/test/javascripts/helpers/chat-stub.js b/plugins/chat/test/javascripts/helpers/chat-stub.js
index 7d9420b3c0b..ad2f8df2c35 100644
--- a/plugins/chat/test/javascripts/helpers/chat-stub.js
+++ b/plugins/chat/test/javascripts/helpers/chat-stub.js
@@ -4,12 +4,10 @@ import Service from "@ember/service";
let publicChannels;
let userCanChat;
-let fullScreenChatOpen;
class ChatStub extends Service {
userCanChat = userCanChat;
publicChannels = publicChannels;
- fullScreenChatOpen = fullScreenChatOpen;
}
export function setup(context, options = {}) {
@@ -20,13 +18,9 @@ export function setup(context, options = {}) {
? options.publicChannels
: [fabricators.chatChannel()];
userCanChat = isPresent(options.userCanChat) ? options.userCanChat : true;
- fullScreenChatOpen = isPresent(options.fullScreenChatOpen)
- ? options.fullScreenChatOpen
- : false;
}
export function teardown() {
publicChannels = [];
userCanChat = true;
- fullScreenChatOpen = false;
}
diff --git a/plugins/chat/test/javascripts/unit/services/chat-state-manager-test.js b/plugins/chat/test/javascripts/unit/services/chat-state-manager-test.js
index 596d8dd5a21..cca77828a08 100644
--- a/plugins/chat/test/javascripts/unit/services/chat-state-manager-test.js
+++ b/plugins/chat/test/javascripts/unit/services/chat-state-manager-test.js
@@ -71,12 +71,63 @@ module(
assert.strictEqual(this.subject.lastKnownAppURL, "/bar");
});
- test("isFullPage", function (assert) {
+ test("isFullPageActive", function (assert) {
sinon.stub(this.subject.router, "currentRouteName").value("foo");
- assert.notOk(this.subject.isFullPage);
+ assert.notOk(this.subject.isFullPageActive);
sinon.stub(this.subject.router, "currentRouteName").value("chat");
- assert.ok(this.subject.isFullPage);
+ assert.ok(this.subject.isFullPageActive);
+ });
+
+ test("didCollapseDrawer", function (assert) {
+ this.subject.didCollapseDrawer();
+
+ assert.strictEqual(this.subject.isDrawerExpanded, false);
+ assert.strictEqual(this.subject.isDrawerActive, true);
+ });
+
+ test("didExpandDrawer", function (assert) {
+ const stub = sinon.stub(
+ this.owner.lookup("service:chat"),
+ "updatePresence"
+ );
+
+ this.subject.didExpandDrawer();
+
+ assert.strictEqual(this.subject.isDrawerExpanded, true);
+ assert.strictEqual(this.subject.isDrawerActive, true);
+ sinon.assert.calledOnce(stub);
+ });
+
+ test("didCloseDrawer", function (assert) {
+ const stub = sinon.stub(
+ this.owner.lookup("service:chat"),
+ "updatePresence"
+ );
+
+ this.subject.didCloseDrawer();
+
+ assert.strictEqual(this.subject.isDrawerExpanded, false);
+ assert.strictEqual(this.subject.isDrawerActive, false);
+ sinon.assert.calledOnce(stub);
+ });
+
+ test("didOpenDrawer", function (assert) {
+ const stub = sinon.stub(
+ this.owner.lookup("service:chat"),
+ "updatePresence"
+ );
+
+ this.subject.didOpenDrawer();
+
+ assert.strictEqual(this.subject.isDrawerExpanded, true);
+ assert.strictEqual(this.subject.isDrawerActive, true);
+ assert.strictEqual(this.subject.lastKnownChatURL, "/chat");
+
+ this.subject.didOpenDrawer("/foo");
+
+ assert.strictEqual(this.subject.lastKnownChatURL, "/foo");
+ sinon.assert.calledTwice(stub);
});
}
);