mirror of
https://github.com/discourse/discourse.git
synced 2025-05-29 01:31:35 +08:00
FEATURE: allows to force a thread (#25987)
Forcing a thread will work even in channel which don't have `threading_enabled` or in direct message channels. For now this feature is only available through the `ChatSDK`: ```ruby ChatSDK::Message.create(in_reply_to_id: 1, guardian: guardian, raw: "foo bar baz", channel_id: 2, force_thread: true) ```
This commit is contained in:
@ -27,6 +27,16 @@ describe ChatSDK::Message do
|
||||
end
|
||||
end
|
||||
|
||||
context "when force_thread is present" do
|
||||
it "creates the message in a thread" do
|
||||
message_1 = described_class.create(**params)
|
||||
message_2 =
|
||||
described_class.create(**params, in_reply_to_id: message_1.id, force_thread: true)
|
||||
|
||||
expect(message_2.thread.force).to eq(true)
|
||||
end
|
||||
end
|
||||
|
||||
context "when channel doesn’t exist" do
|
||||
it "fails" do
|
||||
expect { described_class.create(**params, channel_id: -999) }.to raise_error(
|
||||
|
Reference in New Issue
Block a user