activitypub: when fetching objects, use the preloaded object from the synthesized activity

This commit is contained in:
William Pitcock 2019-03-23 02:38:59 +00:00
parent aabcecb269
commit ce47eb8b29

View file

@ -957,7 +957,7 @@ def fetch_object_from_id(id) do
}, },
:ok <- Transmogrifier.contain_origin(id, params), :ok <- Transmogrifier.contain_origin(id, params),
{:ok, activity} <- Transmogrifier.handle_incoming(params) do {:ok, activity} <- Transmogrifier.handle_incoming(params) do
{:ok, Object.normalize(activity.data["object"])} {:ok, Object.normalize(activity)}
else else
{:error, {:reject, nil}} -> {:error, {:reject, nil}} ->
{:reject, nil} {:reject, nil}
@ -969,7 +969,7 @@ def fetch_object_from_id(id) do
Logger.info("Couldn't get object via AP, trying out OStatus fetching...") Logger.info("Couldn't get object via AP, trying out OStatus fetching...")
case OStatus.fetch_activity_from_url(id) do case OStatus.fetch_activity_from_url(id) do
{:ok, [activity | _]} -> {:ok, Object.normalize(activity.data["object"])} {:ok, [activity | _]} -> {:ok, Object.normalize(activity)}
e -> e e -> e
end end
end end