id
end
+ def get_actor(%{"actor" => nil, "attributedTo" => actor}) when not is_nil(actor) do
+ get_actor(%{"actor" => actor})
+ end
+
@doc """
Checks that an imported AP object's actor matches the domain it came from.
"""
|> Map.put("context", replied_object.data["context"] || object["conversation"])
else
e ->
- Logger.error("Couldn't fetch #{object["inReplyTo"]} #{inspect(e)}")
+ Logger.error("Couldn't fetch \"#{inspect(in_reply_to_id)}\", error: #{inspect(e)}")
object
end
e ->
- Logger.error("Couldn't fetch #{object["inReplyTo"]} #{inspect(e)}")
+ Logger.error("Couldn't fetch \"#{inspect(in_reply_to_id)}\", error: #{inspect(e)}")
object
end
end
end
def fix_attachments(%{"attachment" => attachment} = object) when is_map(attachment) do
- attachment =
- Map.put(attachment, "url", [
- %{"type" => "Link", "mediaType" => attachment["mediaType"], "href" => attachment["url"]}
- ])
-
- Map.put(object, "attachment", attachment)
+ Map.put(object, "attachment", [attachment])
+ |> fix_attachments()
end
def fix_attachments(object), do: object