federator: return :ok or :error depending on if an AP doc was accepted or not

This commit is contained in:
William Pitcock 2018-11-17 21:00:37 +00:00
parent 3d9266a8cb
commit 0d1375f274
1 changed files with 4 additions and 1 deletions

View File

@ -106,15 +106,18 @@ def handle(:incoming_ap_doc, params) do
with {:ok, _user} <- ap_enabled_actor(params["actor"]),
nil <- Activity.normalize(params["id"]),
:ok <- Transmogrifier.contain_origin_from_id(params["actor"], params),
{:ok, _activity} <- Transmogrifier.handle_incoming(params) do
{:ok, activity} <- Transmogrifier.handle_incoming(params) do
{:ok, activity}
else
%Activity{} ->
Logger.info("Already had #{params["id"]}")
:error
_e ->
# Just drop those for now
Logger.info("Unhandled activity")
Logger.info(Poison.encode!(params, pretty: 2))
:error
end
end