diff options
author | rinpatch <rinpatch@sdf.org> | 2020-06-09 18:06:27 +0000 |
---|---|---|
committer | rinpatch <rinpatch@sdf.org> | 2020-06-09 18:06:27 +0000 |
commit | 6c90fc8e70760bf8c58bb731ce294e9eee02f430 (patch) | |
tree | bd9a1f004b07c434c1ae2a6b3701ffad52d6304a /lib/pleroma/user | |
parent | a5ccb5b0b1032b102c54d4df2e17c61423089e73 (diff) | |
parent | f05f206e13a152ccdae679e84a29633adfbba2b1 (diff) | |
download | pleroma-2.0.6.tar.gz |
Merge branch 'release/2.0.6' into 'stable'v2.0.6
Release/2.0.6
See merge request pleroma/pleroma!2632
Diffstat (limited to 'lib/pleroma/user')
-rw-r--r-- | lib/pleroma/user/query.ex | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/lib/pleroma/user/query.ex b/lib/pleroma/user/query.ex index ec88088cf..a387f9b77 100644 --- a/lib/pleroma/user/query.ex +++ b/lib/pleroma/user/query.ex @@ -162,20 +162,18 @@ defmodule Pleroma.User.Query do end defp compose_query({:recipients_from_activity, to}, query) do - query - |> join(:left, [u], r in FollowingRelationship, - as: :relationships, - on: r.follower_id == u.id - ) - |> join(:left, [relationships: r], f in User, - as: :following, - on: f.id == r.following_id - ) - |> where( - [u, following: f, relationships: r], - u.ap_id in ^to or (f.follower_address in ^to and r.state == ^:follow_accept) + following_query = + from(u in User, + join: f in FollowingRelationship, + on: u.id == f.following_id, + where: f.state == ^:follow_accept, + where: u.follower_address in ^to, + select: f.follower_id + ) + + from(u in query, + where: u.ap_id in ^to or u.id in subquery(following_query) ) - |> distinct(true) end defp compose_query({:order_by, key}, query) do |