This repository has been archived on 2023-03-18. You can view files and clone it, but cannot push or open issues or pull requests.
osr-discourse-src/plugins/chat/app/controllers/api/chat_channel_threads_controller.rb
2023-02-08 17:01:12 +10:00

19 lines
539 B
Ruby

# frozen_string_literal: true
class Chat::Api::ChatChannelThreadsController < Chat::Api
def show
raise Discourse::NotFound if !SiteSetting.enable_experimental_chat_threaded_discussions
thread =
ChatThread
.includes(:channel)
.includes(original_message_user: :user_status)
.includes(original_message: :chat_webhook_event)
.find(params[:thread_id])
guardian.ensure_can_preview_chat_channel!(thread.channel)
render_serialized(thread, ChatThreadSerializer, root: "thread")
end
end