diff options
author | rinpatch <rinpatch@sdf.org> | 2019-08-11 22:49:55 +0300 |
---|---|---|
committer | rinpatch <rinpatch@sdf.org> | 2019-08-11 22:49:55 +0300 |
commit | 92479c6f4870f1ebe4f530db6e31ba960855e1fa (patch) | |
tree | 703629ad62db5828fb430ac8185de112fe11990d | |
parent | 779e32a879733e07cddc2143db9d903a1e0d94cf (diff) | |
download | pleroma-92479c6f4870f1ebe4f530db6e31ba960855e1fa.tar.gz |
Do not fetch the reply object in `fix_type` unless the object has the
`name` key and use a depth limit when fetching it
-rw-r--r-- | lib/pleroma/web/activity_pub/transmogrifier.ex | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/pleroma/web/activity_pub/transmogrifier.ex b/lib/pleroma/web/activity_pub/transmogrifier.ex index b7bc48f0a..0aee9369f 100644 --- a/lib/pleroma/web/activity_pub/transmogrifier.ex +++ b/lib/pleroma/web/activity_pub/transmogrifier.ex @@ -333,13 +333,15 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier do def fix_type(object, options \\ []) - def fix_type(%{"inReplyTo" => reply_id} = object, options) when is_binary(reply_id) do + def fix_type(%{"inReplyTo" => reply_id, "name" => _} = object, options) + when is_binary(reply_id) do reply = - if Federator.allowed_incoming_reply_depth?(options[:depth]) do - Object.normalize(reply_id, true) + with true <- Federator.allowed_incoming_reply_depth?(options[:depth]), + {:ok, object} <- get_obj_helper(reply_id, options) do + object end - if reply && (reply.data["type"] == "Question" and object["name"]) do + if reply && reply.data["type"] == "Question" do Map.put(object, "type", "Answer") else object |