Add support for incoming remote unfollows
This commit is contained in:
parent
1d4bbec6b3
commit
d8c842a771
4 changed files with 89 additions and 10 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue