update ActivityPub#fetch_activities_query
authorMaksim Pechnikov <parallel588@gmail.com>
Tue, 4 Jun 2019 12:20:24 +0000 (15:20 +0300)
committerMaksim Pechnikov <parallel588@gmail.com>
Tue, 4 Jun 2019 12:21:18 +0000 (15:21 +0300)
lib/pleroma/web/activity_pub/activity_pub.ex

index eefed58329eb6aaee66ee6916944031e486fec23..c0e3d1478794622ccd9d633bc04807fac9faed02 100644 (file)
@@ -575,6 +575,13 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub do
   defp restrict_thread_visibility(query, _, %{skip_thread_containment: true} = _),
     do: query
 
+  defp restrict_thread_visibility(
+         query,
+         %{"user" => %User{info: %{skip_thread_containment: true}}},
+         _
+       ),
+       do: query
+
   defp restrict_thread_visibility(query, %{"user" => %User{ap_id: ap_id}}, _) do
     from(
       a in query,
@@ -860,7 +867,10 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub do
 
   def fetch_activities_query(recipients, opts \\ %{}) do
     base_query = from(activity in Activity)
-    config = Enum.into(Config.get([:instance]), %{})
+
+    config = %{
+      skip_thread_containment: Config.get([:instance, :skip_thread_containment])
+    }
 
     base_query
     |> maybe_preload_objects(opts)