mirror of
https://github.com/discourse/discourse.git
synced 2024-11-25 09:42:07 +08:00
FIX: chat replies are not always in a thread (#27023)
When you reply to a chat message, we [always create a thread][1]. But when the channel we're in doesn't have threading enabled, the reply is _technically_ not a thread.
This changes the `in_thread?` method to check for both the presence of a `thread_id` and to ensure that the channel has `threading_enabled`.
Internal ref - t/128103/3
[1]: e6e3eaf472/plugins/chat/app/services/chat/create_message.rb (L110-L115)
This commit is contained in:
parent
af6759f5e2
commit
02469d5795
|
@ -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?
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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!
|
||||
|
|
Loading…
Reference in New Issue
Block a user