gab-social/app/controllers/api/v1/account_by_username_controller.rb

27 lines
558 B
Ruby
Raw Normal View History

2019-07-02 03:10:25 -04:00
# frozen_string_literal: true
class Api::V1::AccountByUsernameController < Api::BaseController
before_action :set_account
before_action :check_account_suspension
2020-04-17 01:35:46 -04:00
before_action :check_account_local
2019-07-02 03:10:25 -04:00
respond_to :json
def show
render json: @account, serializer: REST::AccountSerializer
end
def set_account
2019-11-17 19:54:18 -06:00
@account = Account.find_acct!(params[:username])
2019-07-02 03:10:25 -04:00
end
def check_account_suspension
gone if @account.suspended?
end
2020-04-17 01:35:46 -04:00
# if not our domain don't display
def check_account_local
gone unless @account.local?
end
2019-07-02 03:10:25 -04:00
end