Skip to content

A platform for community discussion. Free, open, simple.

FIX: ensures thread panel closes on escape (#29651)

Joffrey JAFFEUXfc5c0270f79b
diff --git a/plugins/chat/assets/javascripts/discourse/services/chat-thread-pane.js b/plugins/chat/assets/javascripts/discourse/services/chat-thread-pane.js
index 6372b9ad363..e3445361868 100644
--- a/plugins/chat/assets/javascripts/discourse/services/chat-thread-pane.js
+++ b/plugins/chat/assets/javascripts/discourse/services/chat-thread-pane.js
@@ -10,7 +10,10 @@ export default class ChatThreadPane extends ChatChannelPane {
}
get isOpened() {
- return this.router.currentRoute.name === "chat.channel.thread";
+ return (
+ this.router.currentRoute.name === "chat.channel.thread" ||
+ this.router.currentRoute.name === "chat.channel.thread.index"
+ );
}
get selectedMessageIds() {
diff --git a/plugins/chat/spec/system/chat/composer/shortcuts/thread_spec.rb b/plugins/chat/spec/system/chat/composer/shortcuts/thread_spec.rb
index 7ba0dc37041..3b5b1a1dc9b 100644
--- a/plugins/chat/spec/system/chat/composer/shortcuts/thread_spec.rb
+++ b/plugins/chat/spec/system/chat/composer/shortcuts/thread_spec.rb
@@ -28,6 +28,14 @@ RSpec.describe "Chat | composer | shortcuts | thread", type: :system do
expect(side_panel_page).to have_open_thread
end
end
+
+ it "closes the thread panel" do
+ chat_page.visit_thread(thread_1)
+ thread_page.composer.cancel_shortcut # ensures we are not focused in the composer
+ page.send_keys(:escape)
+
+ expect(side_panel_page).to have_no_open_thread
+ end
end
describe "ArrowUp" do