formatting
This commit is contained in:
parent
c34f74aaae
commit
9bbe024652
|
@ -8,7 +8,8 @@ defmodule Vonbraun.ActivityPub.Handler.Follow do
|
||||||
|
|
||||||
def type, do: "Follow"
|
def type, do: "Follow"
|
||||||
|
|
||||||
def handle(%{"type" => "Follow", "actor" => follow_requester_id, "object" => follow_target}) when is_binary(follow_requester_id) and is_binary(follow_target) do
|
def handle(%{"type" => "Follow", "actor" => follow_requester_id, "object" => follow_target})
|
||||||
|
when is_binary(follow_requester_id) and is_binary(follow_target) do
|
||||||
with {:valid_target, true} <- {:valid_target, Object.my_id() == follow_target},
|
with {:valid_target, true} <- {:valid_target, Object.my_id() == follow_target},
|
||||||
{:actor, {:ok, actor}} <- {:actor, ActivityPubReq.get_actor(follow_requester_id)},
|
{:actor, {:ok, actor}} <- {:actor, ActivityPubReq.get_actor(follow_requester_id)},
|
||||||
{:add, {:ok, %Actor{:blocked => nil, :follows_me_state => follows_me_state}}}
|
{:add, {:ok, %Actor{:blocked => nil, :follows_me_state => follows_me_state}}}
|
||||||
|
|
|
@ -9,13 +9,11 @@ defmodule Vonbraun.ActivityPub.Handler.Reject do
|
||||||
def type, do: "Reject"
|
def type, do: "Reject"
|
||||||
|
|
||||||
# Lots of kinds of things can be rejected but for right now only follows.
|
# Lots of kinds of things can be rejected but for right now only follows.
|
||||||
def handle(
|
def handle(%{
|
||||||
%{
|
|
||||||
"type" => "Reject",
|
"type" => "Reject",
|
||||||
"actor" => actor_id,
|
"actor" => actor_id,
|
||||||
"object" => object = %{"type" => "Follow"}
|
"object" => object = %{"type" => "Follow"}
|
||||||
}
|
}) do
|
||||||
) do
|
|
||||||
with {:actor, {:ok, follow_actor_id}} <- {:actor, extract_follow_object_actor(object)},
|
with {:actor, {:ok, follow_actor_id}} <- {:actor, extract_follow_object_actor(object)},
|
||||||
{:match, true} <- {:match, follow_actor_id == Object.my_id()},
|
{:match, true} <- {:match, follow_actor_id == Object.my_id()},
|
||||||
{:asked, {:ok, %Actor{:blocked => nil, :following_state => "accepted"}}} <-
|
{:asked, {:ok, %Actor{:blocked => nil, :following_state => "accepted"}}} <-
|
||||||
|
|
Loading…
Reference in New Issue