From 9bbe0246521bcad04dcbfb2e202a92e8335f5f49 Mon Sep 17 00:00:00 2001 From: Moon Man Date: Thu, 29 Aug 2024 11:52:01 +0000 Subject: [PATCH] formatting --- lib/vonbraun/activity_pub/handler/follow.ex | 3 ++- lib/vonbraun/activity_pub/handler/reject.ex | 14 ++++++-------- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/lib/vonbraun/activity_pub/handler/follow.ex b/lib/vonbraun/activity_pub/handler/follow.ex index 85ba203..f607194 100644 --- a/lib/vonbraun/activity_pub/handler/follow.ex +++ b/lib/vonbraun/activity_pub/handler/follow.ex @@ -8,7 +8,8 @@ defmodule Vonbraun.ActivityPub.Handler.Follow do 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}, {:actor, {:ok, actor}} <- {:actor, ActivityPubReq.get_actor(follow_requester_id)}, {:add, {:ok, %Actor{:blocked => nil, :follows_me_state => follows_me_state}}} diff --git a/lib/vonbraun/activity_pub/handler/reject.ex b/lib/vonbraun/activity_pub/handler/reject.ex index 833cdcf..a6269fb 100644 --- a/lib/vonbraun/activity_pub/handler/reject.ex +++ b/lib/vonbraun/activity_pub/handler/reject.ex @@ -9,17 +9,15 @@ defmodule Vonbraun.ActivityPub.Handler.Reject do def type, do: "Reject" # Lots of kinds of things can be rejected but for right now only follows. - def handle( - %{ - "type" => "Reject", - "actor" => actor_id, - "object" => object = %{"type" => "Follow"} - } - ) do + def handle(%{ + "type" => "Reject", + "actor" => actor_id, + "object" => object = %{"type" => "Follow"} + }) do with {:actor, {:ok, follow_actor_id}} <- {:actor, extract_follow_object_actor(object)}, {:match, true} <- {:match, follow_actor_id == Object.my_id()}, {:asked, {:ok, %Actor{:blocked => nil, :following_state => "accepted"}}} <- - {:asked, Actor.mark_pending_follow(actor_id, "rejected", force: true)} do + {:asked, Actor.mark_pending_follow(actor_id, "rejected", force: true)} do Logger.info("Now following: #{actor_id}") {:ok, :following} else