From: Roger Braun Date: Fri, 14 Apr 2017 16:59:11 +0000 (+0200) Subject: Update object correctly after setting context. X-Git-Url: https://git.squeep.com/?a=commitdiff_plain;h=7a47afed3c52f537e9a4851372d76ccf95459799;p=akkoma Update object correctly after setting context. --- diff --git a/lib/pleroma/web/twitter_api/twitter_api.ex b/lib/pleroma/web/twitter_api/twitter_api.ex index a23f465d4..76dbc77a1 100644 --- a/lib/pleroma/web/twitter_api/twitter_api.ex +++ b/lib/pleroma/web/twitter_api/twitter_api.ex @@ -204,6 +204,11 @@ defmodule Pleroma.Web.TwitterAPI.TwitterAPI do |> put_in(["object", "statusnetConversationId"], activity.id) |> put_in(["statusnetConversationId"], activity.id) + object = Object.get_by_ap_id(activity.data["object"]["id"]) + + changeset = Ecto.Changeset.change(object, data: data["object"]) + Repo.update(changeset) + changeset = Ecto.Changeset.change(activity, data: data) Repo.update(changeset) end diff --git a/test/web/twitter_api/twitter_api_test.exs b/test/web/twitter_api/twitter_api_test.exs index 36d4f4012..fd9908b9f 100644 --- a/test/web/twitter_api/twitter_api_test.exs +++ b/test/web/twitter_api/twitter_api_test.exs @@ -48,6 +48,8 @@ defmodule Pleroma.Web.TwitterAPI.TwitterAPITest do assert get_in(activity.data, ["statusnetConversationId"]) == activity.id assert is_list(activity.data["object"]["attachment"]) + + assert activity.data["object"] == Object.get_by_ap_id(activity.data["object"]["id"]).data end test "create a status that is a reply" do