- where(query, [u], u.ap_id in ^to or fragment("? && ?", u.following, ^to))
+ 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)
+ )