summaryrefslogtreecommitdiff
path: root/lib/pleroma/notification.ex
diff options
context:
space:
mode:
Diffstat (limited to 'lib/pleroma/notification.ex')
-rw-r--r--lib/pleroma/notification.ex19
1 files changed, 18 insertions, 1 deletions
diff --git a/lib/pleroma/notification.ex b/lib/pleroma/notification.ex
index c2d4d86a3..8f2b54496 100644
--- a/lib/pleroma/notification.ex
+++ b/lib/pleroma/notification.ex
@@ -138,7 +138,24 @@ defmodule Pleroma.Notification do
query
|> where([n, a], a.actor not in ^blocked_ap_ids)
- |> FollowingRelationship.keep_following_or_not_domain_blocked(user)
+ |> restrict_domain_blocked(user)
+ end
+
+ defp restrict_domain_blocked(query, user) do
+ where(
+ query,
+ [_, activity],
+ fragment(
+ # "(actor's domain NOT in domain_blocks)"
+ """
+ NOT (
+ substring(? from '.*://([^/]*)') = ANY(?)
+ )
+ """,
+ activity.actor,
+ ^user.domain_blocks
+ )
+ )
end
defp exclude_blockers(query, user) do