discourse/plugins/chat/app/controllers/api/chat_channel_threads_contro...

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

22 lines
644 B
Ruby
Raw Normal View History

# frozen_string_literal: true
class Chat::Api::ChatChannelThreadsController < Chat::Api
def show
params.require(:channel_id)
params.require(:thread_id)
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_by!(id: params[:thread_id], channel_id: params[:channel_id])
guardian.ensure_can_preview_chat_channel!(thread.channel)
render_serialized(thread, ChatThreadSerializer, root: "thread")
end
end