aboutsummaryrefslogtreecommitdiff
path: root/app/controllers/api/v1/accounts/lookup_controller.rb
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2020-12-14 01:41:13 +0100
committerEugen Rochko <eugen@zeonfederated.com>2021-02-16 03:33:32 +0100
commitdd512c140bee24446d1ddab901d04b51a72a2d86 (patch)
treec1e2d1beb1058ccc395d65fe586929b4de8add55 /app/controllers/api/v1/accounts/lookup_controller.rb
parent9c273c2a59755a46ff3933470b02df857537a4af (diff)
downloadmastodon-feature-unify-uis.tar
mastodon-feature-unify-uis.tar.gz
mastodon-feature-unify-uis.tar.bz2
mastodon-feature-unify-uis.zip
Diffstat (limited to 'app/controllers/api/v1/accounts/lookup_controller.rb')
-rw-r--r--app/controllers/api/v1/accounts/lookup_controller.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/app/controllers/api/v1/accounts/lookup_controller.rb b/app/controllers/api/v1/accounts/lookup_controller.rb
new file mode 100644
index 000000000..aee6be18a
--- /dev/null
+++ b/app/controllers/api/v1/accounts/lookup_controller.rb
@@ -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