commit: c45013df8e53334bcc1afb8cd1df673c290037ee
parent 130bc8e0d553eb918685edf2b1fdab7e69021446
Author: kaniini <ariadne@dereferenced.org>
Date: Fri, 6 Sep 2019 23:25:30 +0000
Merge branch 'chore/query-optimization' into 'develop'
chore: query optimization
Closes #1224
See merge request pleroma/pleroma!1640
Diffstat:
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/lib/pleroma/activity.ex b/lib/pleroma/activity.ex
@@ -362,12 +362,12 @@ defmodule Pleroma.Activity do
end
def restrict_deactivated_users(query) do
+ deactivated_users =
+ from(u in User.Query.build(deactivated: true), select: u.ap_id)
+ |> Repo.all()
+
from(activity in query,
- where:
- fragment(
- "? not in (SELECT ap_id FROM users WHERE info->'deactivated' @> 'true')",
- activity.actor
- )
+ where: activity.actor not in ^deactivated_users
)
end
diff --git a/lib/pleroma/web/activity_pub/activity_pub.ex b/lib/pleroma/web/activity_pub/activity_pub.ex
@@ -796,7 +796,7 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub do
)
unless opts["skip_preload"] do
- from([thread_mute: tm] in query, where: is_nil(tm))
+ from([thread_mute: tm] in query, where: is_nil(tm.user_id))
else
query
end