activitypub: use Object.normalize() instead of Object.get_by_ap_id() directly.
This commit is contained in:
parent
fb04fecfb4
commit
15d624e077
@ -670,7 +670,7 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub 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 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub 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 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub 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 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier do
|
||||
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 New Issue
Block a user