ObjectValidator: Add actor fetcher.

This commit is contained in:
lain 2020-04-30 14:13:08 +02:00
parent 64bb72f98a
commit 42ce7c5164

View file

@ -46,8 +46,14 @@ def stringify_keys(object) 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