Chatwoot/app/controllers/api/v1/accounts/conversations/messages_controller.rb
2020-07-21 12:15:24 +05:30

19 lines
498 B
Ruby

class Api::V1::Accounts::Conversations::MessagesController < Api::V1::Accounts::Conversations::BaseController
def index
@messages = message_finder.perform
end
def create
user = current_user || @resource
mb = Messages::MessageBuilder.new(user, @conversation, params)
@message = mb.perform
rescue StandardError => e
render_could_not_create_error(e.message)
end
private
def message_finder
@message_finder ||= MessageFinder.new(@conversation, params)
end
end