diff options
author | lain <lain@soykaf.club> | 2019-09-30 18:13:05 +0200 |
---|---|---|
committer | lain <lain@soykaf.club> | 2019-09-30 18:13:05 +0200 |
commit | dae744478e7a5b789f2fb541b47eea558a0f2d53 (patch) | |
tree | 16cf0ab6647994efd8e332207d189606762515e0 /lib | |
parent | a22a7437d84065192601f73da73d2c27111c9b15 (diff) | |
download | pleroma-dae744478e7a5b789f2fb541b47eea558a0f2d53.tar.gz |
Transmogrifier: Handle compact objects in undos.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/pleroma/web/activity_pub/transmogrifier.ex | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/lib/pleroma/web/activity_pub/transmogrifier.ex b/lib/pleroma/web/activity_pub/transmogrifier.ex index 63877248a..3ca2e8773 100644 --- a/lib/pleroma/web/activity_pub/transmogrifier.ex +++ b/lib/pleroma/web/activity_pub/transmogrifier.ex @@ -753,6 +753,24 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier do end end + # For Undos that don't have the complete object attached, try to find it in our database. + def handle_incoming( + %{ + "type" => "Undo", + "object" => object + } = activity, + options + ) + when is_binary(object) do + with %Activity{data: data} <- Activity.get_by_ap_id(object) do + activity + |> Map.put("object", data) + |> handle_incoming(options) + else + _e -> :error + end + end + def handle_incoming(_, _), do: :error @spec get_obj_helper(String.t(), Keyword.t()) :: {:ok, Object.t()} | nil |