1
0
Fork 0
forked from mirrors/akkoma

Merge branch 'fix/fix-type-depth' into 'develop'

Do not fetch the reply object in `fix_type` unless the object has the `name` key and use a depth limit when fetching it

See merge request pleroma/pleroma!1552
This commit is contained in:
rinpatch 2019-08-11 20:01:10 +00:00
commit 9a8a01837e

View file

@ -333,13 +333,15 @@ def fix_content_map(object), do: object
def fix_type(object, options \\ []) 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 = reply =
if Federator.allowed_incoming_reply_depth?(options[:depth]) do with true <- Federator.allowed_incoming_reply_depth?(options[:depth]),
Object.normalize(reply_id, true) {:ok, object} <- get_obj_helper(reply_id, options) do
object
end end
if reply && (reply.data["type"] == "Question" and object["name"]) do if reply && reply.data["type"] == "Question" do
Map.put(object, "type", "Answer") Map.put(object, "type", "Answer")
else else
object object