X-Git-Url: http://git.squeep.com/?a=blobdiff_plain;ds=sidebyside;f=lib%2Fpleroma%2Fweb%2Ftwitter_api%2Ftwitter_api.ex;h=db521a3ad09599568d52dc597c2b1e469e8dc6e4;hb=833161b5d21f85e2276cd0cee3e148ecbe6e1f05;hp=162beb9be06b7ffb7f95b51efb434ed3d5d1871a;hpb=6c8d15da110e86f799052c82df8b7b2404f8f722;p=akkoma 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