twitterapi: activity view: add the other in_reply_to fields
authorWilliam Pitcock <nenolod@dereferenced.org>
Thu, 25 Oct 2018 04:04:04 +0000 (04:04 +0000)
committerWilliam Pitcock <nenolod@dereferenced.org>
Thu, 25 Oct 2018 04:04:04 +0000 (04:04 +0000)
lib/pleroma/web/twitter_api/representers/activity_representer.ex
lib/pleroma/web/twitter_api/views/activity_view.ex

index 04857001cdef9f1dc3ea6591be0881d0ca838771..fbd33f07ed1297dfe148c6b9e8e4a727c40bd86c 100644 (file)
@@ -182,12 +182,7 @@ defmodule Pleroma.Web.TwitterAPI.Representers.ActivityRepresenter do
 
     reply_parent = Activity.get_in_reply_to_activity(activity)
 
-    reply_user_nickname =
-      if reply_parent do
-        User.get_cached_by_ap_id(reply_parent.actor).nickname
-      else
-        nil
-      end
+    reply_user = reply_parent && User.get_cached_by_ap_id(reply_parent.actor)
 
     %{
       "id" => activity.id,
@@ -199,7 +194,10 @@ defmodule Pleroma.Web.TwitterAPI.Representers.ActivityRepresenter do
       "is_post_verb" => true,
       "created_at" => created_at,
       "in_reply_to_status_id" => object["inReplyToStatusId"],
-      "in_reply_to_screen_name" => reply_user_nickname,
+      "in_reply_to_screen_name" => reply_user && reply_user.nickname,
+      "in_reply_to_profileurl" => User.profile_url(reply_user),
+      "in_reply_to_ostatus_uri" => reply_user && reply_user.ap_id,
+      "in_reply_to_user_id" => reply_user && reply_user.id,
       "statusnet_conversation_id" => conversation_id,
       "attachments" => attachments |> ObjectRepresenter.enum_to_list(opts),
       "attentions" => attentions,
index 13fb04f952cb82004c25deb626b6daea7cf768dc..fb97f199bcde8a9a444754350fe9bb26df719825 100644 (file)
@@ -238,12 +238,7 @@ defmodule Pleroma.Web.TwitterAPI.ActivityView do
 
     reply_parent = Activity.get_in_reply_to_activity(activity)
 
-    reply_user_nickname =
-      if reply_parent do
-        User.get_cached_by_ap_id(reply_parent.actor).nickname
-      else
-        nil
-      end
+    reply_user = reply_parent && User.get_cached_by_ap_id(reply_parent.actor)
 
     %{
       "id" => activity.id,
@@ -255,7 +250,10 @@ defmodule Pleroma.Web.TwitterAPI.ActivityView do
       "is_post_verb" => true,
       "created_at" => created_at,
       "in_reply_to_status_id" => object["inReplyToStatusId"],
-      "in_reply_to_screen_name" => reply_user_nickname,
+      "in_reply_to_screen_name" => reply_user && reply_user.nickname,
+      "in_reply_to_profileurl" => User.profile_url(reply_user),
+      "in_reply_to_ostatus_uri" => reply_user && reply_user.ap_id,
+      "in_reply_to_user_id" => reply_user && reply_user.id,
       "statusnet_conversation_id" => conversation_id,
       "attachments" => (object["attachment"] || []) |> ObjectRepresenter.enum_to_list(opts),
       "attentions" => attentions,