From: William Pitcock Date: Tue, 29 May 2018 10:18:23 +0000 (+0000) Subject: activitypub transmogrifier: accept/reject outgoing: we might send the actual object... X-Git-Url: https://git.squeep.com/?a=commitdiff_plain;h=d96377f3590c08a2c38941299aedb977b1b5a8e5;p=akkoma activitypub transmogrifier: accept/reject outgoing: we might send the actual object instead of the URI in some cases, handle it --- diff --git a/lib/pleroma/web/activity_pub/transmogrifier.ex b/lib/pleroma/web/activity_pub/transmogrifier.ex index 08173f78d..e7a3420d2 100644 --- a/lib/pleroma/web/activity_pub/transmogrifier.ex +++ b/lib/pleroma/web/activity_pub/transmogrifier.ex @@ -443,7 +443,14 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier do # Mastodon Accept/Reject requires a non-normalized object containing the actor URIs, # because of course it does. def prepare_outgoing(%{"type" => "Accept"} = data) do - with follow_activity <- Activity.get_by_ap_id(data["object"]) do + follow_activity_id = + if is_binary(data["object"]) do + data["object"] + else + data["object"]["id"] + end + + with follow_activity <- Activity.get_by_ap_id(follow_activity_id) do object = %{ "actor" => follow_activity.actor, "object" => follow_activity.data["object"], @@ -461,7 +468,14 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier do end def prepare_outgoing(%{"type" => "Reject"} = data) do - with follow_activity <- Activity.get_by_ap_id(data["object"]) do + follow_activity_id = + if is_binary(data["object"]) do + data["object"] + else + data["object"]["id"] + end + + with follow_activity <- Activity.get_by_ap_id(follow_activity_id) do object = %{ "actor" => follow_activity.actor, "object" => follow_activity.data["object"],