diff options
author | lain <lain@soykaf.club> | 2018-02-18 22:37:44 +0100 |
---|---|---|
committer | lain <lain@soykaf.club> | 2018-02-18 22:37:44 +0100 |
commit | 76e71f47d3324e2718c37713a5ee03d9e3f2b7fa (patch) | |
tree | a67d55da46845bfe61007093a52fdd4549ede356 | |
parent | 010f818a29d813e912cc38b3bdc259bed9837ed9 (diff) | |
download | pleroma-76e71f47d3324e2718c37713a5ee03d9e3f2b7fa.tar.gz |
Inbox: Don't add the same thing twice.
-rw-r--r-- | lib/pleroma/web/activity_pub/activity_pub_controller.ex | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/pleroma/web/activity_pub/activity_pub_controller.ex b/lib/pleroma/web/activity_pub/activity_pub_controller.ex index f4e5ae9eb..da4973fe5 100644 --- a/lib/pleroma/web/activity_pub/activity_pub_controller.ex +++ b/lib/pleroma/web/activity_pub/activity_pub_controller.ex @@ -1,6 +1,6 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubController do use Pleroma.Web, :controller - alias Pleroma.{User, Repo, Object} + alias Pleroma.{User, Repo, Object, Activity} alias Pleroma.Web.ActivityPub.{ObjectView, UserView, Transmogrifier} alias Pleroma.Web.ActivityPub.ActivityPub @@ -26,9 +26,13 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubController do def inbox(%{assigns: %{valid_signature: true}} = conn, params) do # File.write("/tmp/incoming.json", Poison.encode!(params)) with {:ok, _user} <- ap_enabled_actor(params["actor"]), + nil <- Activity.get_by_ap_id(params["id"]), {:ok, activity} <- Transmogrifier.handle_incoming(params) do json(conn, "ok") else + %Activity{} -> + Logger.info("Already had #{params["id"]}") + json(conn, "ok") e -> # Just drop those for now Logger.info("Unhandled activity") |