Moar coverage

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel
2018-11-27 17:54:54 +01:00
parent b99625afab
commit da378633ac
13 changed files with 287 additions and 84 deletions

View File

@@ -154,7 +154,7 @@ defmodule Mobilizon.Service.ActivityPub do
end
def follow(%Actor{} = follower, %Actor{} = followed, _activity_id \\ nil, local \\ true) do
with {:ok, follow} <- Actor.follow(follower, followed, true),
with {:ok, follow} <- Actor.follow(followed, follower, true),
data <- make_follow_data(follower, followed, follow.id),
{:ok, activity} <- insert(data, local),
:ok <- maybe_federate(activity) do
@@ -251,8 +251,7 @@ defmodule Mobilizon.Service.ActivityPub do
followers =
if actor.followers_url in activity.recipients do
{:ok, followers} = Actor.get_followers(actor)
followers |> Enum.filter(fn follower -> is_nil(follower.domain) end)
Actor.get_followers(actor) |> Enum.filter(fn follower -> is_nil(follower.domain) end)
else
[]
end