aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorkaniini <nenolod@gmail.com>2019-05-11 16:52:26 +0000
committerkaniini <nenolod@gmail.com>2019-05-11 16:52:26 +0000
commit131f88320740bec9c74e4280a6b1a7d8641ee367 (patch)
treea9ccbf42b3cb98d4de184625c6f140007af50ebc /lib
parent8caea9be729827095d14bcb87ab6b5d5c15f4935 (diff)
parent1d78e42fd4ca73402c4101ac01b9abb44f4f8cf6 (diff)
downloadpleroma-131f88320740bec9c74e4280a6b1a7d8641ee367.tar.gz
Merge branch 'fix/ostatus-activity-representer-depends-on-emebeded-objects' into 'develop'
Fix get_in_reply_to in OStatus' activity representer depending on embedded objects See merge request pleroma/pleroma!1129
Diffstat (limited to 'lib')
-rw-r--r--lib/pleroma/web/ostatus/activity_representer.ex21
1 files changed, 11 insertions, 10 deletions
diff --git a/lib/pleroma/web/ostatus/activity_representer.ex b/lib/pleroma/web/ostatus/activity_representer.ex
index 166691a09..95037125d 100644
--- a/lib/pleroma/web/ostatus/activity_representer.ex
+++ b/lib/pleroma/web/ostatus/activity_representer.ex
@@ -18,15 +18,18 @@ defmodule Pleroma.Web.OStatus.ActivityRepresenter do
end
end
- defp get_in_reply_to(%{"object" => %{"inReplyTo" => in_reply_to}}) do
- [
- {:"thr:in-reply-to",
- [ref: to_charlist(in_reply_to), href: to_charlist(get_href(in_reply_to))], []}
- ]
+ defp get_in_reply_to(activity) do
+ with %Object{data: %{"inReplyTo" => in_reply_to}} <- Object.normalize(activity) do
+ [
+ {:"thr:in-reply-to",
+ [ref: to_charlist(in_reply_to), href: to_charlist(get_href(in_reply_to))], []}
+ ]
+ else
+ _ ->
+ []
+ end
end
- defp get_in_reply_to(_), do: []
-
defp get_mentions(to) do
Enum.map(to, fn id ->
cond do
@@ -98,7 +101,7 @@ defmodule Pleroma.Web.OStatus.ActivityRepresenter do
[]}
end)
- in_reply_to = get_in_reply_to(activity.data)
+ in_reply_to = get_in_reply_to(activity)
author = if with_author, do: [{:author, UserRepresenter.to_simple_form(user)}], else: []
mentions = activity.recipients |> get_mentions
@@ -146,7 +149,6 @@ defmodule Pleroma.Web.OStatus.ActivityRepresenter do
updated_at = activity.data["published"]
inserted_at = activity.data["published"]
- _in_reply_to = get_in_reply_to(activity.data)
author = if with_author, do: [{:author, UserRepresenter.to_simple_form(user)}], else: []
mentions = activity.recipients |> get_mentions
@@ -177,7 +179,6 @@ defmodule Pleroma.Web.OStatus.ActivityRepresenter do
updated_at = activity.data["published"]
inserted_at = activity.data["published"]
- _in_reply_to = get_in_reply_to(activity.data)
author = if with_author, do: [{:author, UserRepresenter.to_simple_form(user)}], else: []
retweeted_activity = Activity.get_create_by_object_ap_id(activity.data["object"])