Add some twapi fixes.
authorRoger Braun <roger@rogerbraun.net>
Sun, 7 May 2017 18:20:53 +0000 (20:20 +0200)
committerRoger Braun <roger@rogerbraun.net>
Sun, 7 May 2017 18:20:53 +0000 (20:20 +0200)
lib/pleroma/web/twitter_api/representers/activity_representer.ex
test/web/twitter_api/representers/activity_representer_test.exs

index affd435771e28d4f792d933b6041cd1bdbe58994..6b189b3c08f19853074eedb3a036f85895e9e285 100644 (file)
@@ -29,7 +29,8 @@ defmodule Pleroma.Web.TwitterAPI.Representers.ActivityRepresenter do
       "uri" => "tag:#{activity.data["id"]}:objectType=note",
       "created_at" => created_at,
       "retweeted_status" => retweeted_status,
-      "statusnet_conversation_id" => conversation_id(announced_activity)
+      "statusnet_conversation_id" => conversation_id(announced_activity),
+      "external_url" => activity.data["id"]
     }
   end
 
@@ -49,6 +50,7 @@ defmodule Pleroma.Web.TwitterAPI.Representers.ActivityRepresenter do
       "uri" => "tag:#{activity.data["id"]}:objectType=Favourite",
       "created_at" => created_at,
       "in_reply_to_status_id" => liked_activity.id,
+      "external_url" => activity.data["id"]
     }
   end
 
@@ -67,6 +69,7 @@ defmodule Pleroma.Web.TwitterAPI.Representers.ActivityRepresenter do
       "is_post_verb" => false,
       "created_at" => created_at,
       "in_reply_to_status_id" => nil,
+      "external_url" => activity.data["id"]
     }
   end
 
@@ -103,6 +106,7 @@ defmodule Pleroma.Web.TwitterAPI.Representers.ActivityRepresenter do
       "repeat_num" => announcement_count,
       "favorited" => to_boolean(favorited),
       "repeated" => to_boolean(repeated),
+      "external_url" => activity.data["id"]
     }
   end
 
index 84c8d9a49ee5c94bcca61ff6814093a5865b312e..f4f3c9aba2b79a0109acbcea3d8d4c2a97f77aaf 100644 (file)
@@ -77,6 +77,7 @@ defmodule Pleroma.Web.TwitterAPI.Representers.ActivityRepresenterTest do
       id: 1,
       data: %{
         "type" => "Create",
+        "id" => "id",
         "to" => [
           User.ap_followers(user),
           "https://www.w3.org/ns/activitystreams#Public",
@@ -121,7 +122,8 @@ defmodule Pleroma.Web.TwitterAPI.Representers.ActivityRepresenterTest do
       "fave_num" => 5,
       "repeat_num" => 3,
       "favorited" => false,
-      "repeated" => false
+      "repeated" => false,
+      "external_url" => activity.data["id"]
     }
 
     assert ActivityRepresenter.to_map(activity, %{user: user, for: follower, mentioned: [mentioned_user]}) == expected_status