twitterapi: activity view: implement in_reply_to_screen_name using the new graph walking helper
This commit is contained in:
parent
f3f736afc4
commit
fee43ae5e7
2 changed files with 20 additions and 0 deletions
|
@ -180,6 +180,15 @@ def to_map(
|
|||
|
||||
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 @@ def to_map(
|
|||
"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,
|
||||
|
|
|
@ -236,6 +236,15 @@ def render(
|
|||
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 @@ def render(
|
|||
"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,
|
||||
|
|
Loading…
Reference in a new issue