def unfollow(%User{} = follower, %User{} = followed) do
ap_followers = followed.follower_address
- if following?(follower, followed) do
+ if following?(follower, followed) and follower.ap_id != followed.ap_id do
following = follower.following
|> List.delete(ap_followers)
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