summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Gleason <alex@alexgleason.me>2022-01-09 15:29:55 -0600
committerAlex Gleason <alex@alexgleason.me>2022-01-15 12:10:34 -0600
commit898c8fda4b3bec5004dc6910a824ccab6ce31ed9 (patch)
tree25bffea4756cf3590d588e482ee9cedc2821e347
parent71baa713bc0ea3305ea69732a6f99a0e5537af3d (diff)
Change blocking/blockers queries to use indexblocking-use-index
-rw-r--r--lib/pleroma/notification.ex4
-rw-r--r--lib/pleroma/web/activity_pub/activity_pub.ex4
2 files changed, 4 insertions, 4 deletions
diff --git a/lib/pleroma/notification.ex b/lib/pleroma/notification.ex
index 9e0ce0329..0853b7619 100644
--- a/lib/pleroma/notification.ex
+++ b/lib/pleroma/notification.ex
@@ -138,7 +138,7 @@ defmodule Pleroma.Notification do
blocked_ap_ids = opts[:blocked_users_ap_ids] || User.blocked_users_ap_ids(user)
query
- |> where([n, a], a.actor not in ^blocked_ap_ids)
+ |> where([n, a], fragment("not (? && ?)", [a.actor], ^blocked_ap_ids))
|> FollowingRelationship.keep_following_or_not_domain_blocked(user)
end
@@ -149,7 +149,7 @@ defmodule Pleroma.Notification do
blocker_ap_ids = User.incoming_relationships_ungrouped_ap_ids(user, [:block])
query
- |> where([n, a], a.actor not in ^blocker_ap_ids)
+ |> where([n, a], fragment("not (? && ?)", [a.actor], ^blocker_ap_ids))
end
end
diff --git a/lib/pleroma/web/activity_pub/activity_pub.ex b/lib/pleroma/web/activity_pub/activity_pub.ex
index 756096952..ae3624515 100644
--- a/lib/pleroma/web/activity_pub/activity_pub.ex
+++ b/lib/pleroma/web/activity_pub/activity_pub.ex
@@ -1035,7 +1035,7 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub do
from(
[activity, object: o] in query,
# You don't block the author
- where: fragment("not (? = ANY(?))", activity.actor, ^blocked_ap_ids),
+ where: fragment("not (? && ?)", [activity.actor], ^blocked_ap_ids),
# You don't block any recipients, and didn't author the post
where:
@@ -1099,7 +1099,7 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub do
from(
activity in query,
# The author doesn't block you
- where: fragment("not (? = ANY(?))", activity.actor, ^blocker_ap_ids),
+ where: fragment("not (? && ?)", [activity.actor], ^blocker_ap_ids),
# It's not a boost of a user that blocks you
where: