aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorWilliam Pitcock <nenolod@dereferenced.org>2018-11-29 03:34:57 +0000
committerWilliam Pitcock <nenolod@dereferenced.org>2018-12-04 04:52:09 +0000
commit6f90f2c3ac70c74b9d06debb09530d5f479b5a8c (patch)
tree05c5c3aad5103348b0485f161512b6c07920a2ef /lib
parentfe000f82f8e1a37a063c7260033f6c3fd275c8cc (diff)
downloadpleroma-6f90f2c3ac70c74b9d06debb09530d5f479b5a8c.tar.gz
activitypub: rework thread filtering for split object view
Diffstat (limited to 'lib')
-rw-r--r--lib/pleroma/web/activity_pub/activity_pub.ex19
1 files changed, 11 insertions, 8 deletions
diff --git a/lib/pleroma/web/activity_pub/activity_pub.ex b/lib/pleroma/web/activity_pub/activity_pub.ex
index dcf670afb..34a84b045 100644
--- a/lib/pleroma/web/activity_pub/activity_pub.ex
+++ b/lib/pleroma/web/activity_pub/activity_pub.ex
@@ -799,18 +799,21 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub do
# guard
def entire_thread_visible_for_user?(nil, user), do: false
- # child
+ # child / root
def entire_thread_visible_for_user?(
- %Activity{data: %{"object" => %{"inReplyTo" => parent_id}}} = tail,
+ %Activity{data: %{"object" => object_id}} = tail,
user
- )
- when is_binary(parent_id) do
+ ) do
parent = Activity.get_in_reply_to_activity(tail)
- visible_for_user?(tail, user) && entire_thread_visible_for_user?(parent, user)
- end
- # root
- def entire_thread_visible_for_user?(tail, user), do: visible_for_user?(tail, user)
+ cond do
+ !is_nil(parent) ->
+ visible_for_user?(tail, user) && entire_thread_visible_for_user?(parent, user)
+
+ true ->
+ visible_for_user?(tail, user)
+ end
+ end
# filter out broken threads
def contain_broken_threads(%Activity{} = activity, %User{} = user) do