Merge branch 'feature/domain-blocks' into 'develop'

Domain blocks

See merge request pleroma/pleroma!190
This commit is contained in:
lambda 2018-06-11 11:19:45 +00:00
commit 7f79b467b1
7 changed files with 115 additions and 3 deletions

View 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 (split_part(?, '/', 3) = ANY(?))", activity.actor, ^domain_blocks)
)
end