streamer: adapt thread containment changes
This commit is contained in:
parent
23765e513d
commit
079f1c3aa2
@ -1216,7 +1216,25 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub do
|
|||||||
|
|
||||||
# do post-processing on a specific activity
|
# do post-processing on a specific activity
|
||||||
def contain_activity(%Activity{} = activity, %User{} = user) do
|
def contain_activity(%Activity{} = activity, %User{} = user) do
|
||||||
contain_broken_threads(activity, user)
|
strategy = Pleroma.Config.get([:instance, :default_reply_visibility])
|
||||||
|
|
||||||
|
case strategy do
|
||||||
|
"public" ->
|
||||||
|
Pleroma.Constants.as_public() in activity.recipients
|
||||||
|
|
||||||
|
"self" ->
|
||||||
|
user.ap_id in activity.recipients
|
||||||
|
|
||||||
|
"following" ->
|
||||||
|
friends = ([user.ap_id] ++ get_friend_ap_ids(user)) |> Enum.into(MapSet.new())
|
||||||
|
|
||||||
|
!(activity.recipients
|
||||||
|
|> Enum.into(MapSet.new())
|
||||||
|
|> MapSet.disjoint?(friends))
|
||||||
|
|
||||||
|
_ ->
|
||||||
|
true
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def fetch_direct_messages_query do
|
def fetch_direct_messages_query do
|
||||||
|
@ -6,7 +6,6 @@ defmodule Pleroma.Web.Streamer do
|
|||||||
use GenServer
|
use GenServer
|
||||||
require Logger
|
require Logger
|
||||||
alias Pleroma.Activity
|
alias Pleroma.Activity
|
||||||
alias Pleroma.Config
|
|
||||||
alias Pleroma.Conversation.Participation
|
alias Pleroma.Conversation.Participation
|
||||||
alias Pleroma.Notification
|
alias Pleroma.Notification
|
||||||
alias Pleroma.Object
|
alias Pleroma.Object
|
||||||
@ -309,10 +308,6 @@ defmodule Pleroma.Web.Streamer do
|
|||||||
defp thread_containment(_activity, %User{info: %{skip_thread_containment: true}}), do: true
|
defp thread_containment(_activity, %User{info: %{skip_thread_containment: true}}), do: true
|
||||||
|
|
||||||
defp thread_containment(activity, user) do
|
defp thread_containment(activity, user) do
|
||||||
if Config.get([:instance, :skip_thread_containment]) do
|
|
||||||
true
|
|
||||||
else
|
|
||||||
ActivityPub.contain_activity(activity, user)
|
ActivityPub.contain_activity(activity, user)
|
||||||
end
|
end
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user