Progress on DMs

Progress on DMs
This commit is contained in:
mgabdev
2020-12-19 01:33:33 -05:00
parent 47cd60f851
commit 7ec426e3d8
38 changed files with 447 additions and 197 deletions

View File

@@ -5,6 +5,7 @@ class Api::V1::ChatMessagesController < Api::BaseController
before_action -> { doorkeeper_authorize! :write, :'write:chats' }
before_action :require_user!
before_action :set_chat_message, only: :destroy
def create
@chat_conversation = ChatConversation.find(chat_params[:chat_conversation_id])
@@ -13,8 +14,9 @@ class Api::V1::ChatMessagesController < Api::BaseController
end
def destroy
@chat = DeleteChatMessageService.new.call(current_user.account, params[:id])
render json: @chat, serializer: REST::ChatMessageSerializer
return not_found if @chatMessage.nil?
DeleteChatMessageService.new.call(@chatMessage)
render json: @chatMessage, serializer: REST::ChatMessageSerializer
end
private
@@ -23,4 +25,8 @@ class Api::V1::ChatMessagesController < Api::BaseController
params.permit(:text, :chat_conversation_id)
end
def set_chat_message
@chatMessage = ChatMessage.where(from_account: current_user.account).find(params[:id])
end
end