Extract deactivated users query to a join
This commit is contained in:
parent
3d1828f43b
commit
4d321be05c
1 changed files with 5 additions and 3 deletions
|
@ -361,9 +361,11 @@ def following_requests_for_actor(%User{ap_id: ap_id}) do
|
|||
end
|
||||
|
||||
def restrict_deactivated_users(query) do
|
||||
deactivated_users_query = from(u in User.Query.build(%{deactivated: true}), select: u.ap_id)
|
||||
|
||||
from(activity in query, where: activity.actor not in subquery(deactivated_users_query))
|
||||
query
|
||||
|> join(:inner, [activity], user in User,
|
||||
as: :user,
|
||||
on: activity.actor == user.ap_id and user.is_active == true
|
||||
)
|
||||
end
|
||||
|
||||
defdelegate search(user, query, options \\ []), to: Pleroma.Activity.Search
|
||||
|
|
Loading…
Reference in a new issue