Revert "Undo formatting in user.ex"

This reverts commit e6dc15b96c.
This commit is contained in:
Francis Dinh 2018-05-17 23:55:00 -04:00
commit 8d11bae0d5
3 changed files with 75 additions and 0 deletions

View file

@ -241,6 +241,24 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier do
end
end
def handle_incoming(
%{
"type" => "Undo",
"object" => %{"type" => "Follow", "object" => followed},
"actor" => follower,
"id" => id
} = data
) do
with %User{local: true} = followed = User.get_cached_by_ap_id(followed),
%User{} = follower = User.get_or_fetch_by_ap_id(follower),
{:ok, activity} <- ActivityPub.unfollow(follower, followed, false) do
User.unfollow(follower, followed)
{:ok, activity}
else
e -> :error
end
end
# TODO
# Accept
# Undo for non-Announce