Hook unfollow into TwitterAPI

This commit is contained in:
Francis Dinh 2018-05-22 04:49:30 -04:00
parent b2c6ae7d82
commit 55f9aefd08
1 changed files with 1 additions and 8 deletions

View File

@ -36,14 +36,7 @@ def follow(%User{} = follower, params) do
def unfollow(%User{} = follower, params) do def unfollow(%User{} = follower, params) do
with {:ok, %User{} = unfollowed} <- get_user(params), with {:ok, %User{} = unfollowed} <- get_user(params),
{:ok, follower, follow_activity} <- User.unfollow(follower, unfollowed), {:ok, follower, follow_activity} <- User.unfollow(follower, unfollowed),
{:ok, _activity} <- {:ok, _activity} <- ActivityPub.unfollow(follower, unfollowed) do
ActivityPub.insert(%{
"type" => "Undo",
"actor" => follower.ap_id,
# get latest Follow for these users
"object" => follow_activity.data["id"],
"published" => make_date()
}) do
{:ok, follower, unfollowed} {:ok, follower, unfollowed}
else else
err -> err err -> err