FIX: quote from thread in drawer mode (#31137)

Due to a recent regression the selection management was failing in
drawer mode for threads. We were not correctly setting the active
thread.

This commit fixes the issue and adds a spec.
This commit is contained in:
Joffrey JAFFEUX 2025-02-03 21:20:50 +01:00 committed by GitHub
parent 4b037a7f90
commit ab4ca0be6e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 25 additions and 0 deletions

View File

@ -93,6 +93,7 @@ const ROUTES = {
afterModel(model) { afterModel(model) {
this.chat.activeChannel = model.channel; this.chat.activeChannel = model.channel;
this.chat.activeChannel.activeThread = model.thread;
}, },
deactivate() { deactivate() {
@ -123,6 +124,7 @@ const ROUTES = {
afterModel(model) { afterModel(model) {
this.chat.activeChannel = model.channel; this.chat.activeChannel = model.channel;
this.chat.activeChannel.activeThread = model.thread;
}, },
deactivate() { deactivate() {

View File

@ -9,6 +9,8 @@ RSpec.describe "Quoting chat message transcripts", type: :system do
let(:chat_page) { PageObjects::Pages::Chat.new } let(:chat_page) { PageObjects::Pages::Chat.new }
let(:channel_page) { PageObjects::Pages::ChatChannel.new } let(:channel_page) { PageObjects::Pages::ChatChannel.new }
let(:topic_page) { PageObjects::Pages::Topic.new } let(:topic_page) { PageObjects::Pages::Topic.new }
let(:thread_page) { PageObjects::Pages::ChatThread.new }
let(:drawer_page) { PageObjects::Pages::ChatDrawer.new }
before do before do
chat_system_bootstrap(admin, [chat_channel_1]) chat_system_bootstrap(admin, [chat_channel_1])
@ -150,6 +152,27 @@ RSpec.describe "Quoting chat message transcripts", type: :system do
expect(page).to have_current_path(topic.url) expect(page).to have_current_path(topic.url)
end end
context "when quoting from a thread" do
fab!(:thread_1) { Fabricate(:chat_thread, channel: chat_channel_1) }
before { chat_channel_1.update!(threading_enabled: true) }
context "when in drawer mode" do
before { chat_page.prefers_drawer }
it "correctly quotes the message" do
visit("/")
chat_page.open_from_header
drawer_page.open_channel(thread_1.channel)
channel_page.reply_to(message_1)
thread_page.messages.select(message_1)
thread_page.selection_management.quote
expect(topic_page).to have_composer_content(generate_transcript(message_1, current_user))
end
end
end
context "when on mobile" do context "when on mobile" do
it "first navigates to the channel's category before opening the topic composer with the quote prefilled", it "first navigates to the channel's category before opening the topic composer with the quote prefilled",
mobile: true do mobile: true do