0
0
Fork 0

Refactor controllers for statuses, accounts, and more (#11249)

This commit is contained in:
Eugen Rochko 2019-07-08 12:03:45 +02:00 committed by GitHub
parent f14776475d
commit 63c7fe8e48
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
41 changed files with 299 additions and 289 deletions

View file

@ -1,10 +1,9 @@
# frozen_string_literal: true
class Api::ProofsController < Api::BaseController
before_action :set_account
include AccountOwnedConcern
before_action :set_provider
before_action :check_account_approval
before_action :check_account_suspension
def index
render json: @account, serializer: @provider.serializer_class
@ -16,15 +15,7 @@ class Api::ProofsController < Api::BaseController
@provider = ProofProvider.find(params[:provider]) || raise(ActiveRecord::RecordNotFound)
end
def set_account
@account = Account.find_local!(params[:username])
end
def check_account_approval
not_found if @account.user_pending?
end
def check_account_suspension
gone if @account.suspended?
def username_param
params[:username]
end
end