forked from mirrors/akkoma
use fetch_object_from_id for ap protocol handler
This commit is contained in:
parent
0f9be97112
commit
5bbeeeeedd
|
@ -10,6 +10,7 @@ defmodule Pleroma.Web.AkkomaAPI.ProtocolHandlerController do
|
|||
alias Pleroma.Activity
|
||||
alias Pleroma.User
|
||||
alias Pleroma.Web.Plugs.OAuthScopesPlug
|
||||
alias Pleroma.Object.Fetcher
|
||||
|
||||
@oauth_search_actions [:handle]
|
||||
|
||||
|
@ -43,8 +44,7 @@ defp find_and_redirect(conn, "@" <> identifier) do
|
|||
end
|
||||
|
||||
defp find_and_redirect(%{assigns: %{user: user}} = conn, identifier) do
|
||||
redirect_to_target(User.get_or_fetch("https://" <> identifier), conn)
|
||||
|| redirect_to_target(Activity.search(user, "https://" <> identifier, [limit: 1]), conn)
|
||||
redirect_to_target(Fetcher.fetch_object_from_id("https://" <> identifier), conn)
|
||||
|| conn |> json_response(:not_found, "Not Found - #{identifier}")
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue