gearheads
/
mastodon
Archived
2
0
Fork 0

Add `GET /api/v1/accounts/lookup` REST API (#15740)

gh/stable
Eugen Rochko 2021-02-16 15:28:32 +01:00 committed by GitHub
parent 3f8523130d
commit e31ed27485
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 0 deletions

View File

@ -0,0 +1,16 @@
# frozen_string_literal: true
class Api::V1::Accounts::LookupController < Api::BaseController
before_action -> { authorize_if_got_token! :read, :'read:accounts' }
before_action :set_account
def show
render json: @account, serializer: REST::AccountSerializer
end
private
def set_account
@account = ResolveAccountService.new.call(params[:acct], skip_webfinger: true) || raise(ActiveRecord::RecordNotFound)
end
end

View File

@ -431,6 +431,7 @@ Rails.application.routes.draw do
get :verify_credentials, to: 'credentials#show' get :verify_credentials, to: 'credentials#show'
patch :update_credentials, to: 'credentials#update' patch :update_credentials, to: 'credentials#update'
resource :search, only: :show, controller: :search resource :search, only: :show, controller: :search
resource :lookup, only: :show, controller: :lookup
resources :relationships, only: :index resources :relationships, only: :index
end end