From 7f486cbc9b187976ee6dd21b5b0677ffe272f56d Mon Sep 17 00:00:00 2001 From: Joffrey JAFFEUX Date: Wed, 8 Mar 2023 15:21:20 +0100 Subject: [PATCH] FIX: do not show infinite loading state on draft with new users (#20582) --- .../discourse/components/chat-live-pane.js | 1 + .../chat/spec/system/draft_message_spec.rb | 26 +++++++++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 plugins/chat/spec/system/draft_message_spec.rb diff --git a/plugins/chat/assets/javascripts/discourse/components/chat-live-pane.js b/plugins/chat/assets/javascripts/discourse/components/chat-live-pane.js index e5044dafe70..8a4410f2e6c 100644 --- a/plugins/chat/assets/javascripts/discourse/components/chat-live-pane.js +++ b/plugins/chat/assets/javascripts/discourse/components/chat-live-pane.js @@ -115,6 +115,7 @@ export default class ChatLivePane extends Component { @action loadMessages() { if (!this.args.channel?.id) { + this.loadedOnce = true; return; } diff --git a/plugins/chat/spec/system/draft_message_spec.rb b/plugins/chat/spec/system/draft_message_spec.rb new file mode 100644 index 00000000000..f72bede4598 --- /dev/null +++ b/plugins/chat/spec/system/draft_message_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +RSpec.describe "Draft message", type: :system, js: true do + fab!(:current_user) { Fabricate(:admin) } + let(:chat_page) { PageObjects::Pages::Chat.new } + let(:channel_page) { PageObjects::Pages::ChatChannel.new } + let(:drawer) { PageObjects::Pages::ChatDrawer.new } + + before do + chat_system_bootstrap + sign_in(current_user) + end + + context "when current user never interacted with other user" do + fab!(:user) { Fabricate(:user) } + + it "opens channel info page" do + visit("/chat/draft-channel") + expect(page).to have_selector(".results") + + find(".results .user:nth-child(1)").click + + expect(channel_page).to have_no_loading_skeleton + end + end +end