mirror of
https://github.com/discourse/discourse.git
synced 2025-05-23 18:41:07 +08:00
FEATURE: Reacting to MessageBus in chat thread panel (#21070)
This commit introduces a ChatChannelPaneSubscriptionsManager and a ChatChannelThreadPaneSubscriptionsManager that inherits from the first service that handle MessageBus subscriptions for the main channel and the thread panel respectively. This necessitated a change to Chat::Publisher to be able to send MessageBus messages to multiple channels based on whether a message was an OM for a thread, a thread reply, or a regular channel message. An initial change to update the thread indicator with new replies has been done too, but that will be improved in future as we have more data to update on the indicators. Still remaining is to fully move over the handleSentMessage functionality which includes scrolling and new message indicator things. Co-authored-by: Joffrey JAFFEUX <j.jaffeux@gmail.com>
This commit is contained in:
@ -4,6 +4,7 @@ RSpec.describe "Quoting chat message transcripts", type: :system, js: true do
|
||||
fab!(:current_user) { Fabricate(:user) }
|
||||
fab!(:chat_channel_1) { Fabricate(:chat_channel) }
|
||||
|
||||
let(:cdp) { PageObjects::CDP.new }
|
||||
let(:chat_page) { PageObjects::Pages::Chat.new }
|
||||
let(:chat_channel_page) { PageObjects::Pages::ChatChannel.new }
|
||||
let(:topic_page) { PageObjects::Pages::Topic.new }
|
||||
@ -25,30 +26,6 @@ RSpec.describe "Quoting chat message transcripts", type: :system, js: true do
|
||||
end
|
||||
end
|
||||
|
||||
def cdp_allow_clipboard_access!
|
||||
cdp_params = {
|
||||
origin: page.server_url,
|
||||
permission: {
|
||||
name: "clipboard-read",
|
||||
},
|
||||
setting: "granted",
|
||||
}
|
||||
page.driver.browser.execute_cdp("Browser.setPermission", **cdp_params)
|
||||
|
||||
cdp_params = {
|
||||
origin: page.server_url,
|
||||
permission: {
|
||||
name: "clipboard-write",
|
||||
},
|
||||
setting: "granted",
|
||||
}
|
||||
page.driver.browser.execute_cdp("Browser.setPermission", **cdp_params)
|
||||
end
|
||||
|
||||
def read_clipboard
|
||||
page.evaluate_async_script("navigator.clipboard.readText().then(arguments[0])")
|
||||
end
|
||||
|
||||
def click_selection_button(button)
|
||||
selector =
|
||||
case button
|
||||
@ -70,7 +47,7 @@ RSpec.describe "Quoting chat message transcripts", type: :system, js: true do
|
||||
expect(chat_channel_page).to have_selection_management
|
||||
click_selection_button("copy")
|
||||
expect(page).to have_selector(".chat-copy-success")
|
||||
clip_text = read_clipboard
|
||||
clip_text = cdp.read_clipboard
|
||||
expect(clip_text.chomp).to eq(generate_transcript(messages, current_user))
|
||||
clip_text
|
||||
end
|
||||
@ -84,7 +61,7 @@ RSpec.describe "Quoting chat message transcripts", type: :system, js: true do
|
||||
end
|
||||
|
||||
describe "copying quote transcripts with the clipboard" do
|
||||
before { cdp_allow_clipboard_access! }
|
||||
before { cdp.allow_clipboard }
|
||||
|
||||
context "when quoting a single message into a topic" do
|
||||
fab!(:post_1) { Fabricate(:post) }
|
||||
|
Reference in New Issue
Block a user