This commit is contained in:
mgabdev
2020-12-16 02:39:07 -05:00
parent d1ff39bb81
commit 8f94ffad9c
64 changed files with 958 additions and 870 deletions

View File

@@ -7,37 +7,31 @@ class Api::V1::ChatConversationAccountsController < Api::BaseController
before_action :require_user!
before_action :set_account
def is_messenger_blocked
#
end
def is_messenger_muted
#
end
def block_messenger
BlockMessengerService.new.call(current_user.account, @account)
render json: @account, serializer: REST::RelationshipSerializer, relationships: relationships
end
def mute_messenger
MuteMessengerService.new.call(current_user.account, @account)
render json: @account, serializer: REST::RelationshipSerializer, relationships: relationships
end
def unblock_messenger
UnblockMessengerService.new.call(current_user.account, @account)
render json: @account, serializer: REST::RelationshipSerializer, relationships: relationships
end
def unmute_messenger
UnmuteMessegerService.new.call(current_user.account, @account)
render json: @account, serializer: REST::RelationshipSerializer, relationships: relationships
def mute_chat_conversation
@chat_conversation_account.is_muted = true
@chat_conversation_account.save!
render json: @chat_conversation_account, serializer: REST::ChatConversationAccountSerializer
end
def unmute_chat_conversation
@chat_conversation_account.is_muted = false
@chat_conversation_account.save!
render json: @chat_conversation_account, serializer: REST::ChatConversationAccountSerializer
end
def set_expiration_policy
if current_user.account.is_pro
#
# : todo :
render json: @chat_conversation_account, serializer: REST::ChatConversationAccountSerializer
else
render json: { error: 'You need to be a GabPRO member to access this' }, status: 422
@@ -50,6 +44,14 @@ class Api::V1::ChatConversationAccountsController < Api::BaseController
@account = Account.find(params[:id])
end
def set_chat_conversation
@chat_conversation = ChatConversation.find(params[:id])
@chat_conversation_account = ChatConversationAccount.where(
account: current_account,
chat_conversation: @chat_conversation
).first
end
def check_account_suspension
gone if @account.suspended?
end