Fix fetching statuses from Mastodon
This commit is contained in:
parent
afff7c4fb3
commit
ef3b435a8d
|
@ -19,7 +19,8 @@ defmodule Clacks.ActivityPub.Fetcher do
|
||||||
def fetch_object(id) do
|
def fetch_object(id) do
|
||||||
%{host: id_host} = URI.parse(id)
|
%{host: id_host} = URI.parse(id)
|
||||||
|
|
||||||
with %{"actor" => remote_actor} = object <- fetch(id),
|
with object when is_map(object) <- fetch(id),
|
||||||
|
remote_actor when is_binary(remote_actor) <- get_actor(object),
|
||||||
%{host: ^id_host} <- URI.parse(remote_actor) do
|
%{host: ^id_host} <- URI.parse(remote_actor) do
|
||||||
object
|
object
|
||||||
else
|
else
|
||||||
|
@ -48,4 +49,9 @@ defmodule Clacks.ActivityPub.Fetcher do
|
||||||
nil
|
nil
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@spec get_actor(data :: map()) :: String.t() | nil
|
||||||
|
defp get_actor(%{"actor" => actor}) when is_binary(actor), do: actor
|
||||||
|
defp get_actor(%{"attributedTo" => actor}) when is_binary(actor), do: actor
|
||||||
|
defp get_actor(_), do: nil
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue