logo

pleroma

My custom branche(s) on git.pleroma.social/pleroma/pleroma git clone https://hacktivis.me/git/pleroma.git
commit: 4d321be05c0aa34921f96f38c17dd611691f3c44
parent 3d1828f43bd5ca59424616d2c1d0462bf75bcf20
Author: FloatingGhost <hannah@coffee-and-dreams.uk>
Date:   Mon, 10 Oct 2022 15:55:58 +0100

Extract deactivated users query to a join

Diffstat:

Mlib/pleroma/activity.ex8+++++---
1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/lib/pleroma/activity.ex b/lib/pleroma/activity.ex @@ -361,9 +361,11 @@ defmodule Pleroma.Activity 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