aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWilliam Pitcock <nenolod@dereferenced.org>2018-10-25 02:54:29 +0000
committerWilliam Pitcock <nenolod@dereferenced.org>2018-10-25 02:59:04 +0000
commitfee43ae5e748368022cc5dc6393015ef64e0894b (patch)
tree14e242c71d677a67e406f3c5946debe1ee6689bb
parentf3f736afc4b4532ef71d5c6aba42945bd26a7699 (diff)
downloadpleroma-fee43ae5e748368022cc5dc6393015ef64e0894b.tar.gz
twitterapi: activity view: implement in_reply_to_screen_name using the new graph walking helper
-rw-r--r--lib/pleroma/web/twitter_api/representers/activity_representer.ex10
-rw-r--r--lib/pleroma/web/twitter_api/views/activity_view.ex10
2 files changed, 20 insertions, 0 deletions
diff --git a/lib/pleroma/web/twitter_api/representers/activity_representer.ex b/lib/pleroma/web/twitter_api/representers/activity_representer.ex
index b21bbb205..04857001c 100644
--- a/lib/pleroma/web/twitter_api/representers/activity_representer.ex
+++ b/lib/pleroma/web/twitter_api/representers/activity_representer.ex
@@ -180,6 +180,15 @@ defmodule Pleroma.Web.TwitterAPI.Representers.ActivityRepresenter do
attachments = (object["attachment"] || []) ++ video
+ 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
+
%{
"id" => activity.id,
"uri" => activity.data["object"]["id"],
@@ -190,6 +199,7 @@ 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,
"statusnet_conversation_id" => conversation_id,
"attachments" => attachments |> ObjectRepresenter.enum_to_list(opts),
"attentions" => attentions,
diff --git a/lib/pleroma/web/twitter_api/views/activity_view.ex b/lib/pleroma/web/twitter_api/views/activity_view.ex
index b9fd062d6..13fb04f95 100644
--- a/lib/pleroma/web/twitter_api/views/activity_view.ex
+++ b/lib/pleroma/web/twitter_api/views/activity_view.ex
@@ -236,6 +236,15 @@ defmodule Pleroma.Web.TwitterAPI.ActivityView do
HTML.filter_tags(content, User.html_filter_policy(opts[:for]))
|> Formatter.emojify(object["emoji"])
+ 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
+
%{
"id" => activity.id,
"uri" => activity.data["object"]["id"],
@@ -246,6 +255,7 @@ 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,
"statusnet_conversation_id" => conversation_id,
"attachments" => (object["attachment"] || []) |> ObjectRepresenter.enum_to_list(opts),
"attentions" => attentions,