FIX: correctly handles near-message-with-thread route in drawer (#27115)

Prior to this fix we wouldn't intercept it, and we also wouldn't handle it, which in result would cause us to handle as a full page interaction and open the full page chat even if you were in drawer mode.
This commit is contained in:
Joffrey JAFFEUX 2024-05-22 21:03:40 +02:00 committed by GitHub
parent 0d49571279
commit 485427b578
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 26 additions and 0 deletions

View File

@ -34,6 +34,7 @@ export default class ChatRoute extends DiscourseRoute {
"chat.channel.thread",
"chat.channel.thread.index",
"chat.channel.thread.near-message",
"chat.channel.near-message-with-thread",
"chat.channel.threads",
"chat.channel.index",
"chat.channel.near-message",

View File

@ -57,6 +57,15 @@ const ROUTES = {
};
},
},
"chat.channel.near-message-with-thread": {
name: ChatDrawerRoutesChannel,
extractParams: (route) => {
return {
channelId: route.parent.params.channelId,
messageId: route.params.messageId,
};
},
},
"chat.channel-legacy": {
name: ChatDrawerRoutesChannel,
extractParams: (route) => {

View File

@ -106,6 +106,22 @@ describe "Single thread in side panel", type: :system do
end
end
context "when in drawer" do
it "opens the channel and highlights the message when clicking original message link" do
visit("/latest")
chat_page.open_from_header
chat_drawer_page.open_channel(channel)
channel_page.message_thread_indicator(thread.original_message).click
find(".chat-message-info__original-message").click
expect(chat_drawer_page).to have_open_channel(channel)
expect(channel_page.messages).to have_message(
id: thread.original_message.id,
highlighted: true,
)
end
end
it "highlights the message in the channel when clicking original message link" do
chat_page.visit_thread(thread)