|
|
@ -12,11 +12,12 @@ defmodule Pleroma.Web.ActivityPub.Relay do
|
|
|
|
%User{} = target_user <- User.get_or_fetch_by_ap_id(target_instance),
|
|
|
|
%User{} = target_user <- User.get_or_fetch_by_ap_id(target_instance),
|
|
|
|
{:ok, activity} <- ActivityPub.follow(local_user, target_user) do
|
|
|
|
{:ok, activity} <- ActivityPub.follow(local_user, target_user) do
|
|
|
|
Logger.info("relay: followed instance: #{target_instance}; id=#{activity.data["id"]}")
|
|
|
|
Logger.info("relay: followed instance: #{target_instance}; id=#{activity.data["id"]}")
|
|
|
|
|
|
|
|
:ok
|
|
|
|
else
|
|
|
|
else
|
|
|
|
e -> Logger.error("error: #{inspect(e)}")
|
|
|
|
e ->
|
|
|
|
|
|
|
|
Logger.error("error: #{inspect(e)}")
|
|
|
|
|
|
|
|
:error
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
:ok
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
def unfollow(target_instance) do
|
|
|
|
def unfollow(target_instance) do
|
|
|
@ -24,11 +25,12 @@ defmodule Pleroma.Web.ActivityPub.Relay do
|
|
|
|
%User{} = target_user <- User.get_or_fetch_by_ap_id(target_instance),
|
|
|
|
%User{} = target_user <- User.get_or_fetch_by_ap_id(target_instance),
|
|
|
|
{:ok, activity} <- ActivityPub.unfollow(local_user, target_user) do
|
|
|
|
{:ok, activity} <- ActivityPub.unfollow(local_user, target_user) do
|
|
|
|
Logger.info("relay: unfollowed instance: #{target_instance}: id=#{activity.data["id"]}")
|
|
|
|
Logger.info("relay: unfollowed instance: #{target_instance}: id=#{activity.data["id"]}")
|
|
|
|
|
|
|
|
:ok
|
|
|
|
else
|
|
|
|
else
|
|
|
|
e -> Logger.error("error: #{inspect(e)}")
|
|
|
|
e ->
|
|
|
|
|
|
|
|
Logger.error("error: #{inspect(e)}")
|
|
|
|
|
|
|
|
:error
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
:ok
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
def publish(%Activity{data: %{"type" => "Create"}} = activity) do
|
|
|
|
def publish(%Activity{data: %{"type" => "Create"}} = activity) do
|
|
|
|