forked from AkkomaGang/akkoma
Merge branch 'chore/query-optimization' into 'develop'
chore: query optimization Closes #1224 See merge request pleroma/pleroma!1640
This commit is contained in:
commit
c45013df8e
2 changed files with 6 additions and 6 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue