with %User{} = local_user <- get_actor(),
%User{} = target_user <- User.get_or_fetch_by_ap_id(target_instance),
{:ok, activity} <- ActivityPub.follow(local_user, target_user) do
- ActivityPub.publish(local_user, activity)
Logger.info("relay: followed instance: #{target_instance}; id=#{activity.data["id"]}")
else
e -> Logger.error("error: #{inspect(e)}")
with %User{} = local_user <- get_actor(),
%User{} = target_user <- User.get_or_fetch_by_ap_id(target_instance),
{:ok, activity} <- ActivityPub.unfollow(local_user, target_user) do
- ActivityPub.publish(local_user, activity)
Logger.info("relay: unfollowed instance: #{target_instance}: id=#{activity.data["id"]}")
else
e -> Logger.error("error: #{inspect(e)}")