Commit e689409a authored by mgabdev's avatar mgabdev

Updated AccountByUsernameController to return error 404 if suspended

• Updated:
- AccountByUsernameController to return error 404 if suspended
parent 5e6211a4
......@@ -2,8 +2,8 @@
class Api::V1::AccountByUsernameController < EmptyController
before_action :set_account
before_action :check_account_suspension
before_action :check_account_local
before_action :check_account_suspension!
before_action :check_account_local!
def show
render json: @account, serializer: REST::AccountSerializer
......@@ -13,12 +13,12 @@ class Api::V1::AccountByUsernameController < EmptyController
@account = Account.find_acct!(params[:username])
end
def check_account_suspension
gone if @account.suspended?
def check_account_suspension!
render json: { error: true }, status: 404 if @account.suspended?
end
# if not our domain don't display
def check_account_local
gone unless @account.local?
def check_account_local!
render json: { error: true }, status: 404 unless @account.local?
end
end
......@@ -55,10 +55,6 @@ class EmptyController < ActionController::Base
nil
end
def gone
respond_with_error(410)
end
def cache_collection(raw, klass)
return raw unless klass.respond_to?(:with_includes)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment