diff options
author | lain <lain@soykaf.club> | 2020-04-30 14:13:08 +0200 |
---|---|---|
committer | lain <lain@soykaf.club> | 2020-04-30 14:13:08 +0200 |
commit | 42ce7c5164326aa577bc7bd18e98c5d0a9d6fea5 (patch) | |
tree | aa35df24dd4cac9d3f834336a1f351609bcbb393 | |
parent | 64bb72f98a91261158b36e63f6c9634ac9f423a6 (diff) | |
download | pleroma-42ce7c5164326aa577bc7bd18e98c5d0a9d6fea5.tar.gz |
ObjectValidator: Add actor fetcher.
-rw-r--r-- | lib/pleroma/web/activity_pub/object_validator.ex | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/pleroma/web/activity_pub/object_validator.ex b/lib/pleroma/web/activity_pub/object_validator.ex index f476c6f72..016f6e7a2 100644 --- a/lib/pleroma/web/activity_pub/object_validator.ex +++ b/lib/pleroma/web/activity_pub/object_validator.ex @@ -46,8 +46,14 @@ defmodule Pleroma.Web.ActivityPub.ObjectValidator do |> Map.new(fn {key, val} -> {to_string(key), val} end) end + def fetch_actor(object) do + with {:ok, actor} <- Types.ObjectID.cast(object["actor"]) do + User.get_or_fetch_by_ap_id(actor) + end + end + def fetch_actor_and_object(object) do - User.get_or_fetch_by_ap_id(object["actor"]) + fetch_actor(object) Object.normalize(object["object"]) :ok end |