Skip to content

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

FIX: chat replies are not always in a thread (#27023)

Régis Hanol02469d5795ab
diff --git a/plugins/chat/app/models/chat/message.rb b/plugins/chat/app/models/chat/message.rb
index 59f3d04fc9b..32cf71b1092 100644
--- a/plugins/chat/app/models/chat/message.rb
+++ b/plugins/chat/app/models/chat/message.rb
@@ -266,7 +266,7 @@ module Chat
end
def in_thread?
- self.thread_id.present?
+ self.thread_id.present? && self.chat_channel.threading_enabled
end
def thread_reply?
diff --git a/plugins/chat/spec/requests/chat/api/messages_controller_spec.rb b/plugins/chat/spec/requests/chat/api/messages_controller_spec.rb
index a7e4dd44c99..0bc3cf2b170 100644
--- a/plugins/chat/spec/requests/chat/api/messages_controller_spec.rb
+++ b/plugins/chat/spec/requests/chat/api/messages_controller_spec.rb
@@ -205,7 +205,9 @@ RSpec.describe Chat::Api::ChannelMessagesController do
let(:message) { "This is a message" }
describe "for category" do
- fab!(:chat_channel) { Fabricate(:category_channel, chatable: category) }
+ fab!(:chat_channel) do
+ Fabricate(:category_channel, chatable: category, threading_enabled: true)
+ end
before do
chat_channel.add(user)
diff --git a/plugins/chat/spec/system/user_menu_notifications/sidebar_spec.rb b/plugins/chat/spec/system/user_menu_notifications/sidebar_spec.rb
index d1b921614e3..3fa514dedd0 100644
--- a/plugins/chat/spec/system/user_menu_notifications/sidebar_spec.rb
+++ b/plugins/chat/spec/system/user_menu_notifications/sidebar_spec.rb
@@ -70,7 +70,7 @@ RSpec.describe "User menu notifications | sidebar", type: :system do
end
context "when category channel" do
- fab!(:channel_1) { Fabricate(:chat_channel) }
+ fab!(:channel_1) { Fabricate(:chat_channel, threading_enabled: true) }
before do
Jobs.run_immediately!