A platform for community discussion. Free, open, simple.
FIX: Chat threads N1 (#22322)
Martin Brennan41ebbab4ffe4
diff --git a/plugins/chat/app/services/chat/lookup_channel_threads.rb b/plugins/chat/app/services/chat/lookup_channel_threads.rbindex 9e08ee0ca5b..3622b0e4aeb 100644--- a/plugins/chat/app/services/chat/lookup_channel_threads.rb+++ b/plugins/chat/app/services/chat/lookup_channel_threads.rb@@ -132,8 +132,10 @@ module Chatoriginal_message_user: :user_status,original_message: [:chat_webhook_event,- :chat_mentions,:chat_channel,+ chat_mentions: {+ user: :user_status,+ },user: :user_status,],)diff --git a/plugins/chat/spec/requests/chat/api/channel_threads_controller_spec.rb b/plugins/chat/spec/requests/chat/api/channel_threads_controller_spec.rbindex db9d5e95f7e..73f62b58c43 100644--- a/plugins/chat/spec/requests/chat/api/channel_threads_controller_spec.rb+++ b/plugins/chat/spec/requests/chat/api/channel_threads_controller_spec.rb@@ -124,6 +124,38 @@ RSpec.describe Chat::Api::ChannelThreadsController do)end+ it "has preloaded chat mentions and users for the thread original message" do+ thread_1.original_message.update!(+ message: "@#{current_user.username} hello and @#{thread_2.original_message_user.username}!",+ )+ thread_1.original_message.rebake!+ thread_1.original_message.create_mentions++ get "/chat/api/channels/#{public_channel.id}/threads"+ expect(response.status).to eq(200)+ expect(+ response.parsed_body["threads"]+ .find { |thread| thread["id"] == thread_1.id }+ .dig("original_message", "mentioned_users"),+ ).to eq(+ [+ {+ "avatar_template" => User.system_avatar_template(current_user.username),+ "id" => current_user.id,+ "name" => current_user.name,+ "username" => current_user.username,+ },+ {+ "avatar_template" =>+ User.system_avatar_template(thread_2.original_message_user.username),+ "id" => thread_2.original_message_user.id,+ "name" => thread_2.original_message_user.name,+ "username" => thread_2.original_message_user.username,+ },+ ],+ )+ end+context "when the channel is not accessible to the useer" dobefore dopublic_channel.update!(chatable: Fabricate(:private_category, group: Fabricate(:group)))