Progress on deck, dms

This commit is contained in:
mgabdev
2020-12-10 11:51:45 -05:00
parent c35e651b43
commit de0c977950
40 changed files with 660 additions and 274 deletions

View File

@@ -1,32 +1,36 @@
# frozen_string_literal: true
class Api::V1::ChatConversationAccountsController < Api::BaseController
before_action -> { authorize_if_got_token! :read, :'read:chats' }, except: [:create, :follow, :unfollow, :block, :unblock, :mute, :unmute]
before_action -> { doorkeeper_authorize! :write, :'write:chats' }, only: [:create]
before_action -> { authorize_if_got_token! :read, :'read:chats' }
before_action -> { doorkeeper_authorize! :write, :'write:chats' }
before_action :require_user!
before_action :set_account, except: [:create]
before_action :set_account
def show
def is_messenger_blocked
#
end
def block
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
MuteMessengerService.new.call(current_user.account, @account, notifications: truthy_param?(:notifications))
def mute_messenger
MuteMessengerService.new.call(current_user.account, @account)
render json: @account, serializer: REST::RelationshipSerializer, relationships: relationships
end
def unblock
def unblock_messenger
UnblockMessengerService.new.call(current_user.account, @account)
render json: @account, serializer: REST::RelationshipSerializer, relationships: relationships
end
def unmute
def unmute_messenger
UnmuteMessegerService.new.call(current_user.account, @account)
render json: @account, serializer: REST::RelationshipSerializer, relationships: relationships
end
@@ -34,19 +38,15 @@ class Api::V1::ChatConversationAccountsController < Api::BaseController
private
def set_account
# @account = Account.find(params[:id])
@account = Account.find(params[:id])
end
# def relationships(**options)
# AccountRelationshipsPresenter.new([@account.id], current_user.account_id, options)
# end
def check_account_suspension
gone if @account.suspended?
end
# def account_params
# params.permit(:username, :email, :password, :agreement, :locale)
# end
def relationships(**options)
AccountRelationshipsPresenter.new([@account.id], current_user.account_id, options)
end
end