mirror of
https://akkoma.dev/AkkomaGang/akkoma.git
synced 2024-12-28 19:20:20 +00:00
activitypub: rework thread filtering for split object view
This commit is contained in:
parent
fe000f82f8
commit
6f90f2c3ac
|
@ -799,18 +799,21 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub do
|
||||||
# guard
|
# guard
|
||||||
def entire_thread_visible_for_user?(nil, user), do: false
|
def entire_thread_visible_for_user?(nil, user), do: false
|
||||||
|
|
||||||
# child
|
# child / root
|
||||||
def entire_thread_visible_for_user?(
|
def entire_thread_visible_for_user?(
|
||||||
%Activity{data: %{"object" => %{"inReplyTo" => parent_id}}} = tail,
|
%Activity{data: %{"object" => object_id}} = tail,
|
||||||
user
|
user
|
||||||
)
|
) do
|
||||||
when is_binary(parent_id) do
|
|
||||||
parent = Activity.get_in_reply_to_activity(tail)
|
parent = Activity.get_in_reply_to_activity(tail)
|
||||||
visible_for_user?(tail, user) && entire_thread_visible_for_user?(parent, user)
|
|
||||||
end
|
|
||||||
|
|
||||||
# root
|
cond do
|
||||||
def entire_thread_visible_for_user?(tail, user), do: visible_for_user?(tail, user)
|
!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
|
# filter out broken threads
|
||||||
def contain_broken_threads(%Activity{} = activity, %User{} = user) do
|
def contain_broken_threads(%Activity{} = activity, %User{} = user) do
|
||||||
|
|
Loading…
Reference in a new issue