mirror of
https://framagit.org/tykayn/mastodon.git
synced 2023-08-25 08:33:12 +02:00
31 lines
666 B
Ruby
31 lines
666 B
Ruby
|
# frozen_string_literal: true
|
||
|
|
||
|
class Api::ProofsController < Api::BaseController
|
||
|
before_action :set_account
|
||
|
before_action :set_provider
|
||
|
before_action :check_account_approval
|
||
|
before_action :check_account_suspension
|
||
|
|
||
|
def index
|
||
|
render json: @account, serializer: @provider.serializer_class
|
||
|
end
|
||
|
|
||
|
private
|
||
|
|
||
|
def set_provider
|
||
|
@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?
|
||
|
end
|
||
|
end
|