# 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"],
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"],