Commit 6f90f2c3 authored by kaniini's avatar kaniini

activitypub: rework thread filtering for split object view

parent fe000f82
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment