mirror of
https://github.com/discourse/discourse.git
synced 2025-05-21 18:12:32 +08:00
FIX: Error when loading a channel with threading enabled but no threads (#22434)
Without this fix, the following error is raised: ``` ActiveRecord::StatementInvalid: PG::SyntaxError: ERROR: syntax error at or near ")" LINE 4: WHERE thread_id IN () ```
This commit is contained in:

committed by
GitHub

parent
96b20077d9
commit
1e26a521c2
@ -10,6 +10,7 @@ RSpec.describe Chat::LookupChannelThreads do
|
||||
|
||||
fab!(:current_user) { Fabricate(:user) }
|
||||
fab!(:channel) { Fabricate(:chat_channel, threading_enabled: true) }
|
||||
fab!(:channel_with_no_threads) { Fabricate(:chat_channel, threading_enabled: true) }
|
||||
fab!(:thread_1) { Fabricate(:chat_thread, channel: channel) }
|
||||
fab!(:thread_2) { Fabricate(:chat_thread, channel: channel) }
|
||||
fab!(:thread_3) { Fabricate(:chat_thread, channel: channel) }
|
||||
@ -32,6 +33,12 @@ RSpec.describe Chat::LookupChannelThreads do
|
||||
end
|
||||
end
|
||||
|
||||
it "does not return any threads when a channel has no threads" do
|
||||
expect(
|
||||
described_class.call(channel_id: channel_with_no_threads.id, guardian:).threads,
|
||||
).to eq([])
|
||||
end
|
||||
|
||||
context "when all steps pass" do
|
||||
before do
|
||||
msg_1 =
|
||||
|
Reference in New Issue
Block a user