Stop adding statusnetConversationIds.
authorRoger Braun <roger@rogerbraun.net>
Sun, 30 Apr 2017 12:02:04 +0000 (14:02 +0200)
committerRoger Braun <roger@rogerbraun.net>
Sun, 30 Apr 2017 12:02:04 +0000 (14:02 +0200)
lib/pleroma/web/activity_pub/activity_pub.ex
test/web/twitter_api/twitter_api_test.exs

index 82f9fcc1c3d38924c1bebe826f360e8f6f98a14d..9441a37aba9b263b51a88176ff64590391fe00b7 100644 (file)
@@ -33,8 +33,6 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub do
     |> Map.merge(additional)
 
     with {:ok, activity} <- insert(activity) do
     |> Map.merge(additional)
 
     with {:ok, activity} <- insert(activity) do
-      {:ok, activity} = add_conversation_id(activity)
-
       if actor.local do
         Pleroma.Web.Federator.enqueue(:publish, activity)
        end
       if actor.local do
         Pleroma.Web.Federator.enqueue(:publish, activity)
        end
@@ -43,24 +41,6 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub do
     end
   end
 
     end
   end
 
-  defp add_conversation_id(activity) do
-    if is_integer(activity.data["statusnetConversationId"]) do
-      {:ok, activity}
-    else
-      data = activity.data
-      |> 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
-  end
-
   def like(%User{ap_id: ap_id} = user, %Object{data: %{ "id" => id}} = object) do
     cond do
       # There's already a like here, so return the original activity.
   def like(%User{ap_id: ap_id} = user, %Object{data: %{ "id" => id}} = object) do
     cond do
       # There's already a like here, so return the original activity.
index 7200112571daee1c6c6c10b7a99c7dd2b38ef274..eb061d334947dc6af0b85edd7f9dc2294ea6f9ae 100644 (file)
@@ -41,11 +41,9 @@ defmodule Pleroma.Web.TwitterAPI.TwitterAPITest do
     assert Enum.member?(get_in(activity.data, ["to"]), "https://www.w3.org/ns/activitystreams#Public")
     assert Enum.member?(get_in(activity.data, ["to"]), "shp")
 
     assert Enum.member?(get_in(activity.data, ["to"]), "https://www.w3.org/ns/activitystreams#Public")
     assert Enum.member?(get_in(activity.data, ["to"]), "shp")
 
-    # Add a context + 'statusnet_conversation_id'
+    # Add a context
     assert is_binary(get_in(activity.data, ["context"]))
     assert is_binary(get_in(activity.data, ["object", "context"]))
     assert is_binary(get_in(activity.data, ["context"]))
     assert is_binary(get_in(activity.data, ["object", "context"]))
-    assert get_in(activity.data, ["object", "statusnetConversationId"]) == activity.id
-    assert get_in(activity.data, ["statusnetConversationId"]) == activity.id
 
     assert is_list(activity.data["object"]["attachment"])
 
 
     assert is_list(activity.data["object"]["attachment"])