activitypub: fix filtering of boosts from blocked users
[akkoma] / lib / pleroma / web / activity_pub / activity_pub.ex
index 54dd4097c755ab99b798a8f11b41915d95d43228..cb88ba308c105deb2d9411d257ed1eb9f75c41a0 100644 (file)
@@ -712,7 +712,14 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub do
     from(
       activity in query,
       where: fragment("not (? = ANY(?))", activity.actor, ^blocks),
-      where: fragment("not (?->'to' \\?| ?)", activity.data, ^blocks),
+      where: fragment("not (? && ?)", activity.recipients, ^blocks),
+      where:
+        fragment(
+          "not (?->>'type' = 'Announce' and ?->'to' \\?| ?)",
+          activity.data,
+          activity.data,
+          ^blocks
+        ),
       where: fragment("not (split_part(?, '/', 3) = ANY(?))", activity.actor, ^domain_blocks)
     )
   end