ActivityPub.ex: filter domain blocked activities.
authoreal <eal@waifu.club>
Sun, 3 Jun 2018 20:33:33 +0000 (23:33 +0300)
committereal <eal@waifu.club>
Sun, 3 Jun 2018 20:33:33 +0000 (23:33 +0300)
lib/pleroma/web/activity_pub/activity_pub.ex

index 4e0be5ba2802143daa32350b2d971ccc6111e650..5c61920e532092b79eba071e1d1967b15461434a 100644 (file)
@@ -439,11 +439,13 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub do
 
   defp restrict_blocked(query, %{"blocking_user" => %User{info: info}}) do
     blocks = info["blocks"] || []
+    domain_blocks = info["domain_blocks"] || []
 
     from(
       activity in query,
       where: fragment("not (? = ANY(?))", activity.actor, ^blocks),
-      where: fragment("not (?->'to' \\?| ?)", activity.data, ^blocks)
+      where: fragment("not (?->'to' \\?| ?)", activity.data, ^blocks),
+      where: fragment("not (? ~ ANY(?))", activity.actor, ^domain_blocks)
     )
   end