activitypub: clean up logging statements a little
[akkoma] / lib / pleroma / web / activity_pub / utils.ex
index da6cca4ddd4052b93013b8c0c3b30a4fd88002b0..964e11c9d424caae12a43dff5e6c2d46157ad06c 100644 (file)
@@ -142,8 +142,14 @@ defmodule Pleroma.Web.ActivityPub.Utils do
     context = context || generate_id("contexts")
     changeset = Object.context_mapping(context)
 
-    with {:ok, object} <- Object.insert_or_get(changeset) do
-      object
+    case Repo.insert(changeset) do
+      {:ok, object} ->
+        object
+
+      # This should be solved by an upsert, but it seems ecto
+      # has problems accessing the constraint inside the jsonb.
+      {:error, _} ->
+        Object.get_cached_by_ap_id(context)
     end
   end