diff options
author | Francis Dinh <normandy@firemail.cc> | 2018-05-17 23:55:00 -0400 |
---|---|---|
committer | Francis Dinh <normandy@firemail.cc> | 2018-05-17 23:55:00 -0400 |
commit | 8d11bae0d5e649f9dc0570b24ee5c4c74b8b463f (patch) | |
tree | 3005c14a3c06dc0d4a44734c7a406d1dffc19202 /lib | |
parent | e6dc15b96cb971836211a1e57be1756936456c17 (diff) | |
download | pleroma-8d11bae0d5e649f9dc0570b24ee5c4c74b8b463f.tar.gz |
Revert "Undo formatting in user.ex"
This reverts commit e6dc15b96cb971836211a1e57be1756936456c17.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/pleroma/web/activity_pub/transmogrifier.ex | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/lib/pleroma/web/activity_pub/transmogrifier.ex b/lib/pleroma/web/activity_pub/transmogrifier.ex index 463d1e59d..0bec8c4dd 100644 --- a/lib/pleroma/web/activity_pub/transmogrifier.ex +++ b/lib/pleroma/web/activity_pub/transmogrifier.ex @@ -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 |