Connect attachments with objects, not activities.
authorRoger Braun <roger@rogerbraun.net>
Thu, 30 Mar 2017 16:07:38 +0000 (18:07 +0200)
committerRoger Braun <roger@rogerbraun.net>
Thu, 30 Mar 2017 16:07:38 +0000 (18:07 +0200)
lib/pleroma/web/twitter_api/representers/activity_representer.ex
lib/pleroma/web/twitter_api/twitter_api.ex
test/web/twitter_api/representers/activity_representer_test.exs
test/web/twitter_api/twitter_api_test.exs

index bcb819200f93ba5308a292c7c1b44b586c790cf5..0cf20dc454915001c0dfdb457b0455e1f65134dc 100644 (file)
@@ -17,7 +17,7 @@ defmodule Pleroma.Web.TwitterAPI.Representers.ActivityRepresenter do
       "created_at" => published,
       "in_reply_to_status_id" => activity.data["object"]["inReplyToStatusId"],
       "statusnet_conversation_id" => activity.data["object"]["statusnetConversationId"],
-      "attachments" => (activity.data["attachment"] || []) |> ObjectRepresenter.enum_to_list(opts)
+      "attachments" => (activity.data["object"]["attachment"] || []) |> ObjectRepresenter.enum_to_list(opts)
     }
   end
 end
index ab2b1aab792cd6123d297f8cdae7dad70c2dd543..c07c7cfbf91853ac1a0ac0b335bdd2076a0f7a0f 100644 (file)
@@ -24,11 +24,11 @@ defmodule Pleroma.Web.TwitterAPI.TwitterAPI do
         "type" => "Note",
         "content" => data["status"],
         "published" => date,
-        "context" => context
+        "context" => context,
+        "attachment" => attachments
       },
       "published" => date,
-      "context" => context,
-      "attachment" => attachments
+      "context" => context
     }
 
     # Wire up reply info.
index 96e6dc98ec76956d84778b45943a31e7a94c2097..91300f229e4b6037486f2ffb2d6af82bd574bd74 100644 (file)
@@ -33,16 +33,16 @@ defmodule Pleroma.Web.TwitterAPI.Representers.ActivityRepresenterTest do
           User.ap_followers(user),
           "https://www.w3.org/ns/activitystreams#Public"
         ],
-        "attachment" => [
-          object
-        ],
         "actor" => User.ap_id(user),
         "object" => %{
           "published" => date,
           "type" => "Note",
           "content" => content,
           "inReplyToStatusId" => 213123,
-          "statusnetConversationId" => 4711
+          "statusnetConversationId" => 4711,
+          "attachment" => [
+            object
+          ]
         },
         "published" => date
       }
index 97657eae07e194a7619bcd1d8c5f5f17e5872f9c..8d123ff4e23c88953705570becc9fcc3c9bf471b 100644 (file)
@@ -40,7 +40,7 @@ defmodule Pleroma.Web.TwitterAPI.TwitterAPITest do
     assert get_in(activity.data, ["object", "statusnetConversationId"]) == activity.id
     assert get_in(activity.data, ["statusnetConversationId"]) == activity.id
 
-    assert is_list(activity.data["attachment"])
+    assert is_list(activity.data["object"]["attachment"])
   end
 
   test "create a status that is a reply" do