Add PleromaAPI.AccountController

This commit is contained in:
Egor Kislitsyn 2019-09-30 14:28:12 +07:00
commit 3c5ecb70b4
No known key found for this signature in database
GPG key ID: 1B49CB15B71E7805
10 changed files with 579 additions and 566 deletions

View file

@ -68,4 +68,11 @@ defmodule Pleroma.Web.ControllerHelper do
conn
end
end
def assign_account_by_id(%{params: %{"id" => id}} = conn, _) do
case Pleroma.User.get_cached_by_id(id) do
%Pleroma.User{} = account -> assign(conn, :account, account)
nil -> Pleroma.Web.MastodonAPI.FallbackController.call(conn, {:error, :not_found}) |> halt()
end
end
end