From f328de8eb77ced729a46e12cbcf898bcfaec78c1 Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Sun, 27 May 2018 09:10:46 +0000 Subject: [PATCH] activitypub transmogrifier: send Rejects in the format Mastodon wants --- .../web/activity_pub/transmogrifier.ex | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/lib/pleroma/web/activity_pub/transmogrifier.ex b/lib/pleroma/web/activity_pub/transmogrifier.ex index 5f5ed7b8e..170bfbc03 100644 --- a/lib/pleroma/web/activity_pub/transmogrifier.ex +++ b/lib/pleroma/web/activity_pub/transmogrifier.ex @@ -456,6 +456,26 @@ def prepare_outgoing(%{"type" => "Accept"} = data) do end end + def prepare_outgoing(%{"type" => "Reject"} = data) do + with follow_activity <- Activity.get_by_ap_id(data["object"]) do + object = %{ + "actor" => follow_activity.actor, + "object" => follow_activity.data["object"], + "id" => follow_activity.data["id"], + "type" => "Follow" + } + + data = + data + |> Map.put("object", object) + |> Map.put("@context", "https://www.w3.org/ns/activitystreams") + + IO.inspect(data) + + {:ok, data} + end + end + def prepare_outgoing(%{"type" => _type} = data) do data = data