diff options
author | rinpatch <rinpatch@sdf.org> | 2019-04-17 17:59:15 +0300 |
---|---|---|
committer | rinpatch <rinpatch@sdf.org> | 2019-04-17 17:59:15 +0300 |
commit | 35ac672b8d4a6711754a5f88ad65e52d356c4c67 (patch) | |
tree | 61b491cff95ada44e04810c254df46b147aab0ac /lib | |
parent | d1eb578a5763638cb9959834814f8632a810f8b2 (diff) | |
download | pleroma-35ac672b8d4a6711754a5f88ad65e52d356c4c67.tar.gz |
Remove containment tests from transmogrifier and fix thread visibility solver
Diffstat (limited to 'lib')
-rw-r--r-- | lib/pleroma/object/containment.ex | 3 | ||||
-rw-r--r-- | lib/pleroma/web/activity_pub/visibility.ex | 21 |
2 files changed, 12 insertions, 12 deletions
diff --git a/lib/pleroma/object/containment.ex b/lib/pleroma/object/containment.ex index 27e89d87f..25bd911fb 100644 --- a/lib/pleroma/object/containment.ex +++ b/lib/pleroma/object/containment.ex @@ -9,9 +9,6 @@ defmodule Pleroma.Object.Containment do Object containment is an important step in validating remote objects to prevent spoofing, therefore removal of object containment functions is NOT recommended. """ - - require Logger - def get_actor(%{"actor" => actor}) when is_binary(actor) do actor end diff --git a/lib/pleroma/web/activity_pub/visibility.ex b/lib/pleroma/web/activity_pub/visibility.ex index db52fe933..3da709b3d 100644 --- a/lib/pleroma/web/activity_pub/visibility.ex +++ b/lib/pleroma/web/activity_pub/visibility.ex @@ -41,16 +41,19 @@ defmodule Pleroma.Web.ActivityPub.Visibility do # guard def entire_thread_visible_for_user?(nil, _user), do: false - # child + # XXX: Probably even more inefficient than the previous implementation, intended to be a placeholder untill https://git.pleroma.social/pleroma/pleroma/merge_requests/971 is in develop def entire_thread_visible_for_user?( - %Activity{data: %{"object" => %{"inReplyTo" => parent_id}}} = tail, + %Activity{} = tail, + # %Activity{data: %{"object" => %{"inReplyTo" => parent_id}}} = tail, user - ) - when is_binary(parent_id) do - parent = Activity.get_in_reply_to_activity(tail) - visible_for_user?(tail, user) && entire_thread_visible_for_user?(parent, user) + ) do + case Object.normalize(tail) do + %{data: %{"inReplyTo" => parent_id}} when is_binary(parent_id) -> + parent = Activity.get_in_reply_to_activity(tail) + visible_for_user?(tail, user) && entire_thread_visible_for_user?(parent, user) + + _ -> + visible_for_user?(tail, user) + end end - - # root - def entire_thread_visible_for_user?(tail, user), do: visible_for_user?(tail, user) end |