aboutsummaryrefslogtreecommitdiff
path: root/lib/pleroma/web/twitter_api/twitter_api.ex
diff options
context:
space:
mode:
Diffstat (limited to 'lib/pleroma/web/twitter_api/twitter_api.ex')
-rw-r--r--lib/pleroma/web/twitter_api/twitter_api.ex12
1 files changed, 10 insertions, 2 deletions
diff --git a/lib/pleroma/web/twitter_api/twitter_api.ex b/lib/pleroma/web/twitter_api/twitter_api.ex
index 162beb9be..db521a3ad 100644
--- a/lib/pleroma/web/twitter_api/twitter_api.ex
+++ b/lib/pleroma/web/twitter_api/twitter_api.ex
@@ -310,8 +310,16 @@ defmodule Pleroma.Web.TwitterAPI.TwitterAPI do
else
_e ->
changeset = Object.context_mapping(context)
- {:ok, object} = Object.insert_or_get(changeset)
- object.id
+
+ case Repo.insert(changeset) do
+ {:ok, %{id: id}} ->
+ id
+
+ # 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).id
+ end
end
end