diff --git a/plugins/chat/assets/javascripts/discourse/connectors/above-site-header/chat-body-class.gjs b/plugins/chat/assets/javascripts/discourse/connectors/above-site-header/chat-body-class.gjs new file mode 100644 index 00000000000..33cbbe8330a --- /dev/null +++ b/plugins/chat/assets/javascripts/discourse/connectors/above-site-header/chat-body-class.gjs @@ -0,0 +1,13 @@ +import Component from "@glimmer/component"; +import { service } from "@ember/service"; +import bodyClass from "discourse/helpers/body-class"; + +export default class ChatBodyClass extends Component { + @service chatStateManager; + + +} diff --git a/plugins/chat/spec/system/page_objects/chat/chat.rb b/plugins/chat/spec/system/page_objects/chat/chat.rb index 24060a02bf7..b42019daab6 100644 --- a/plugins/chat/spec/system/page_objects/chat/chat.rb +++ b/plugins/chat/spec/system/page_objects/chat/chat.rb @@ -52,9 +52,9 @@ module PageObjects drawer?(expectation: false, channel_id: channel_id, expanded: expanded) end - def visit_channel(channel, message_id: nil) + def visit_channel(channel, message_id: nil, with_preloaded_channels: true) visit(channel.url + (message_id ? "/#{message_id}" : "")) - has_finished_loading? + has_finished_loading?(with_preloaded_channels: with_preloaded_channels) end def visit_user_threads @@ -102,7 +102,12 @@ module PageObjects visit("/chat/new-message?recipients=#{recipients}") end - def has_finished_loading? + def has_preloaded_channels? + has_css?("body.has-preloaded-chat-channels") + end + + def has_finished_loading?(with_preloaded_channels: true) + has_preloaded_channels? if with_preloaded_channels has_no_css?(".chat-channel--not-loaded-once") has_no_css?(".chat-skeleton") end diff --git a/plugins/chat/spec/system/visit_channel_spec.rb b/plugins/chat/spec/system/visit_channel_spec.rb index b0ce5790c22..506333ebd7e 100644 --- a/plugins/chat/spec/system/visit_channel_spec.rb +++ b/plugins/chat/spec/system/visit_channel_spec.rb @@ -24,7 +24,7 @@ RSpec.describe "Visit channel", type: :system do end it "shows a not found page" do - chat.visit_channel(category_channel_1) + chat.visit_channel(category_channel_1, with_preloaded_channels: false) expect(page).to have_content(I18n.t("page_not_found.title")) end @@ -33,7 +33,7 @@ RSpec.describe "Visit channel", type: :system do context "when chat enabled" do context "when anonymous" do it "redirects to homepage" do - chat.visit_channel(category_channel_1) + chat.visit_channel(category_channel_1, with_preloaded_channels: false) expect(page).to have_current_path("/latest") end @@ -46,7 +46,7 @@ RSpec.describe "Visit channel", type: :system do before { current_user.user_option.update!(chat_enabled: false) } it "redirects to homepage" do - chat.visit_channel(category_channel_1) + chat.visit_channel(category_channel_1, with_preloaded_channels: false) expect(page).to have_current_path("/latest") end @@ -56,7 +56,7 @@ RSpec.describe "Visit channel", type: :system do before { SiteSetting.chat_allowed_groups = Group::AUTO_GROUPS[:staff] } it "redirects homepage" do - chat.visit_channel(category_channel_1) + chat.visit_channel(category_channel_1, with_preloaded_channels: false) expect(page).to have_current_path("/latest") end