mirror of
https://akkoma.dev/AkkomaGang/akkoma.git
synced 2024-11-23 23:11:13 +00:00
Merge branch 'feature/in-reply-to-screen-name' into 'develop'
initial graph traversal support Closes #68 See merge request pleroma/pleroma!387
This commit is contained in:
commit
a8137159c2
|
@ -82,4 +82,10 @@ defmodule Pleroma.Activity do
|
||||||
def normalize(obj) when is_map(obj), do: Activity.get_by_ap_id(obj["id"])
|
def normalize(obj) when is_map(obj), do: Activity.get_by_ap_id(obj["id"])
|
||||||
def normalize(ap_id) when is_binary(ap_id), do: Activity.get_by_ap_id(ap_id)
|
def normalize(ap_id) when is_binary(ap_id), do: Activity.get_by_ap_id(ap_id)
|
||||||
def normalize(_), do: nil
|
def normalize(_), do: nil
|
||||||
|
|
||||||
|
def get_in_reply_to_activity(%Activity{data: %{"object" => %{"inReplyTo" => ap_id}}}) do
|
||||||
|
get_create_activity_by_object_ap_id(ap_id)
|
||||||
|
end
|
||||||
|
|
||||||
|
def get_in_reply_to_activity(_), do: nil
|
||||||
end
|
end
|
||||||
|
|
|
@ -180,6 +180,15 @@ defmodule Pleroma.Web.TwitterAPI.Representers.ActivityRepresenter do
|
||||||
|
|
||||||
attachments = (object["attachment"] || []) ++ video
|
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,
|
"id" => activity.id,
|
||||||
"uri" => activity.data["object"]["id"],
|
"uri" => activity.data["object"]["id"],
|
||||||
|
@ -190,6 +199,7 @@ defmodule Pleroma.Web.TwitterAPI.Representers.ActivityRepresenter do
|
||||||
"is_post_verb" => true,
|
"is_post_verb" => true,
|
||||||
"created_at" => created_at,
|
"created_at" => created_at,
|
||||||
"in_reply_to_status_id" => object["inReplyToStatusId"],
|
"in_reply_to_status_id" => object["inReplyToStatusId"],
|
||||||
|
"in_reply_to_screen_name" => reply_user_nickname,
|
||||||
"statusnet_conversation_id" => conversation_id,
|
"statusnet_conversation_id" => conversation_id,
|
||||||
"attachments" => attachments |> ObjectRepresenter.enum_to_list(opts),
|
"attachments" => attachments |> ObjectRepresenter.enum_to_list(opts),
|
||||||
"attentions" => attentions,
|
"attentions" => attentions,
|
||||||
|
|
|
@ -236,6 +236,15 @@ defmodule Pleroma.Web.TwitterAPI.ActivityView do
|
||||||
HTML.filter_tags(content, User.html_filter_policy(opts[:for]))
|
HTML.filter_tags(content, User.html_filter_policy(opts[:for]))
|
||||||
|> Formatter.emojify(object["emoji"])
|
|> 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,
|
"id" => activity.id,
|
||||||
"uri" => activity.data["object"]["id"],
|
"uri" => activity.data["object"]["id"],
|
||||||
|
@ -246,6 +255,7 @@ defmodule Pleroma.Web.TwitterAPI.ActivityView do
|
||||||
"is_post_verb" => true,
|
"is_post_verb" => true,
|
||||||
"created_at" => created_at,
|
"created_at" => created_at,
|
||||||
"in_reply_to_status_id" => object["inReplyToStatusId"],
|
"in_reply_to_status_id" => object["inReplyToStatusId"],
|
||||||
|
"in_reply_to_screen_name" => reply_user_nickname,
|
||||||
"statusnet_conversation_id" => conversation_id,
|
"statusnet_conversation_id" => conversation_id,
|
||||||
"attachments" => (object["attachment"] || []) |> ObjectRepresenter.enum_to_list(opts),
|
"attachments" => (object["attachment"] || []) |> ObjectRepresenter.enum_to_list(opts),
|
||||||
"attentions" => attentions,
|
"attentions" => attentions,
|
||||||
|
|
|
@ -139,6 +139,7 @@ defmodule Pleroma.Web.TwitterAPI.Representers.ActivityRepresenterTest do
|
||||||
"is_post_verb" => true,
|
"is_post_verb" => true,
|
||||||
"created_at" => "Tue May 24 13:26:08 +0000 2016",
|
"created_at" => "Tue May 24 13:26:08 +0000 2016",
|
||||||
"in_reply_to_status_id" => 213_123,
|
"in_reply_to_status_id" => 213_123,
|
||||||
|
"in_reply_to_screen_name" => nil,
|
||||||
"statusnet_conversation_id" => convo_object.id,
|
"statusnet_conversation_id" => convo_object.id,
|
||||||
"attachments" => [
|
"attachments" => [
|
||||||
ObjectRepresenter.to_map(object)
|
ObjectRepresenter.to_map(object)
|
||||||
|
|
|
@ -36,6 +36,7 @@ defmodule Pleroma.Web.TwitterAPI.ActivityViewTest do
|
||||||
"favorited" => false,
|
"favorited" => false,
|
||||||
"id" => activity.id,
|
"id" => activity.id,
|
||||||
"in_reply_to_status_id" => nil,
|
"in_reply_to_status_id" => nil,
|
||||||
|
"in_reply_to_screen_name" => nil,
|
||||||
"is_local" => true,
|
"is_local" => true,
|
||||||
"is_post_verb" => true,
|
"is_post_verb" => true,
|
||||||
"possibly_sensitive" => false,
|
"possibly_sensitive" => false,
|
||||||
|
|
Loading…
Reference in a new issue