Commit c45013df authored by kaniini's avatar kaniini

Merge branch 'chore/query-optimization' into 'develop'

chore: query optimization

Closes #1224

See merge request !1640
parents 130bc8e0 40a61532
Pipeline #16834 passed with stages
in 43 minutes and 19 seconds
......@@ -362,12 +362,12 @@ def query_by_actor(actor) 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
......
......@@ -796,7 +796,7 @@ defp restrict_muted(query, %{"muting_user" => %User{info: info}} = opts) 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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment