projects
/
akkoma
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
activitypub: clean up logging statements a little
[akkoma]
/
lib
/
pleroma
/
web
/
activity_pub
/
utils.ex
diff --git
a/lib/pleroma/web/activity_pub/utils.ex
b/lib/pleroma/web/activity_pub/utils.ex
index 134701e80597f95002fa79c9a0fdc95bdbf39e59..964e11c9d424caae12a43dff5e6c2d46157ad06c 100644
(file)
--- a/
lib/pleroma/web/activity_pub/utils.ex
+++ b/
lib/pleroma/web/activity_pub/utils.ex
@@
-3,11
+3,19
@@
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Web.ActivityPub.Utils do
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Web.ActivityPub.Utils do
- alias Pleroma.{Repo, Web, Object, Activity, User, Notification}
+ alias Pleroma.Repo
+ alias Pleroma.Web
+ alias Pleroma.Object
+ alias Pleroma.Activity
+ alias Pleroma.User
+ alias Pleroma.Notification
alias Pleroma.Web.Router.Helpers
alias Pleroma.Web.Endpoint
alias Pleroma.Web.Router.Helpers
alias Pleroma.Web.Endpoint
- alias Ecto.{Changeset, UUID}
+ alias Ecto.Changeset
+ alias Ecto.UUID
+
import Ecto.Query
import Ecto.Query
+
require Logger
@supported_object_types ["Article", "Note", "Video", "Page"]
require Logger
@supported_object_types ["Article", "Note", "Video", "Page"]
@@
-134,8
+142,14
@@
defmodule Pleroma.Web.ActivityPub.Utils do
context = context || generate_id("contexts")
changeset = Object.context_mapping(context)
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
end
end