mirror of
https://github.com/discourse/discourse.git
synced 2025-05-31 20:45:35 +08:00
FIX: do not show threads with no replies (#26033)
Prior to this fix if a user had started to reply to a message without actually sending a message, the thread would still be created and we would end up listing it in the threads list of a channel. This commit also improves adds thread and thread_replies_count to the 4th parameter of the chat_message_created event.
This commit is contained in:
@ -101,7 +101,7 @@ RSpec.describe Chat::CreateMessage do
|
||||
instance_of(Chat::Message),
|
||||
channel,
|
||||
user,
|
||||
anything,
|
||||
has_entries(thread: anything, thread_replies_count: anything, context: anything),
|
||||
)
|
||||
|
||||
result
|
||||
@ -117,7 +117,14 @@ RSpec.describe Chat::CreateMessage do
|
||||
instance_of(Chat::Message),
|
||||
channel,
|
||||
user,
|
||||
{ context: { post_ids: context_post_ids, topic_id: context_topic_id } },
|
||||
has_entries(
|
||||
thread: anything,
|
||||
thread_replies_count: anything,
|
||||
context: {
|
||||
post_ids: context_post_ids,
|
||||
topic_id: context_topic_id,
|
||||
},
|
||||
),
|
||||
)
|
||||
|
||||
result
|
||||
|
@ -61,6 +61,15 @@ describe "Thread list in side panel | full page", type: :system do
|
||||
end
|
||||
end
|
||||
|
||||
it "doesn’t list threads with no replies" do
|
||||
thread = Fabricate(:chat_thread, channel: channel, use_service: true)
|
||||
|
||||
chat_page.visit_channel(channel)
|
||||
channel_page.open_thread_list
|
||||
|
||||
expect(thread_list_page).to have_no_thread(thread)
|
||||
end
|
||||
|
||||
context "when there are threads that the user is participating in" do
|
||||
fab!(:thread_1) do
|
||||
chat_thread_chain_bootstrap(channel: channel, users: [current_user, other_user])
|
||||
|
Reference in New Issue
Block a user