def get_recipients_from_activity(%Activity{data: %{"to" => to}}) do
query = from u in User,
- where: u.local == true
-
- query = from u in query,
where: u.ap_id in ^to,
or_where: fragment("? \\\?| ?", u.following, ^to)
+ query = from u in query,
+ where: u.local == true
+
Repo.all(query)
end
assert [addressed] == User.get_recipients_from_activity(activity)
{:ok, user} = User.follow(user, actor)
+ {:ok, user_two} = User.follow(user_two, actor)
recipients = User.get_recipients_from_activity(activity)
assert length(recipients) == 2
assert user in recipients