ActivityPub: Partly handle incoming follows.
This commit is contained in:
parent
5682e48a25
commit
e7b73359e3
3 changed files with 58 additions and 0 deletions
|
|
@ -38,6 +38,20 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier do
|
|||
end
|
||||
end
|
||||
|
||||
def handle_incoming(%{"type" => "Follow", "object" => followed, "actor" => follower, "id" => id}) do
|
||||
with %User{} = followed <- User.get_cached_by_ap_id(followed),
|
||||
%User{} = follower <- User.get_or_fetch_by_ap_id(follower),
|
||||
{:ok, activity} <- ActivityPub.follow(follower, followed, id, false) do
|
||||
# TODO: Send an "Accept" activity.
|
||||
User.follow(follower, followed)
|
||||
{:ok, activity}
|
||||
else
|
||||
_e -> :error
|
||||
end
|
||||
end
|
||||
|
||||
def handle_incoming(_), do: :error
|
||||
|
||||
@doc
|
||||
"""
|
||||
internal -> Mastodon
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue