|
|
|
@ -123,6 +123,33 @@ defmodule Clacks.Inbox do
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def handle(
|
|
|
|
|
%{
|
|
|
|
|
"type" => "Undo",
|
|
|
|
|
"actor" => follower_id,
|
|
|
|
|
"object" => %{"type" => "Follow", "object" => followee_id}
|
|
|
|
|
} = activity
|
|
|
|
|
)
|
|
|
|
|
when is_binary(followee_id) do
|
|
|
|
|
followee = Actor.get_by_ap_id(followee_id)
|
|
|
|
|
|
|
|
|
|
store_activity(activity)
|
|
|
|
|
|
|
|
|
|
changeset =
|
|
|
|
|
Actor.changeset(followee, %{
|
|
|
|
|
followers: List.delete(followee.followers, follower_id)
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
case Repo.update(changeset) do
|
|
|
|
|
{:error, changeset} ->
|
|
|
|
|
Logger.error("Couldn't store updated followers: #{inspect(changeset)}")
|
|
|
|
|
{:error, "Couldn't store updated followers"}
|
|
|
|
|
|
|
|
|
|
{:ok, _followee} ->
|
|
|
|
|
:ok
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
# as a fallback, just store the activity
|
|
|
|
|
def handle(activity) do
|
|
|
|
|
Logger.debug("Unhandled activity: #{inspect(activity)}")
|
|
|
|
|