logo

pleroma

My custom branche(s) on git.pleroma.social/pleroma/pleroma
commit: 9a8a01837eb7c3e0577a283671d8a82af29a0771
parent: 779e32a879733e07cddc2143db9d903a1e0d94cf
Author: rinpatch <rinpatch@sdf.org>
Date:   Sun, 11 Aug 2019 20:01:10 +0000

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

Diffstat:

Mlib/pleroma/web/activity_pub/transmogrifier.ex10++++++----
1 file changed, 6 insertions(+), 4 deletions(-)

diff --git 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