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