activitypub: use Object.normalize() instead of Object.get_by_ap_id() directly.
This commit is contained in:
parent
fb04fecfb4
commit
15d624e077
2 changed files with 4 additions and 4 deletions
|
@ -670,7 +670,7 @@ def fetch_object_from_id(id) do
|
|||
recv_timeout: 20000
|
||||
),
|
||||
{:ok, data} <- Jason.decode(body),
|
||||
nil <- Object.get_by_ap_id(data["id"]),
|
||||
nil <- Object.normalize(data),
|
||||
params <- %{
|
||||
"type" => "Create",
|
||||
"to" => data["to"],
|
||||
|
@ -679,7 +679,7 @@ def fetch_object_from_id(id) do
|
|||
"object" => data
|
||||
},
|
||||
{:ok, activity} <- Transmogrifier.handle_incoming(params) do
|
||||
{:ok, Object.get_by_ap_id(activity.data["object"]["id"])}
|
||||
{:ok, Object.normalize(activity.data["object"])}
|
||||
else
|
||||
object = %Object{} ->
|
||||
{:ok, object}
|
||||
|
@ -688,7 +688,7 @@ def fetch_object_from_id(id) do
|
|||
Logger.info("Couldn't get object via AP, trying out OStatus fetching...")
|
||||
|
||||
case OStatus.fetch_activity_from_url(id) do
|
||||
{:ok, [activity | _]} -> {:ok, Object.get_by_ap_id(activity.data["object"]["id"])}
|
||||
{:ok, [activity | _]} -> {:ok, Object.normalize(activity.data["object"])}
|
||||
e -> e
|
||||
end
|
||||
end
|
||||
|
|
|
@ -412,7 +412,7 @@ def handle_incoming(
|
|||
def handle_incoming(_), do: :error
|
||||
|
||||
def get_obj_helper(id) do
|
||||
if object = Object.get_by_ap_id(id), do: {:ok, object}, else: nil
|
||||
if object = Object.normalize(id), do: {:ok, object}, else: nil
|
||||
end
|
||||
|
||||
def set_reply_to_uri(%{"inReplyTo" => inReplyTo} = object) do
|
||||
|
|
Loading…
Reference in a new issue