aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorRoger Braun <roger@rogerbraun.net>2017-08-01 17:35:19 +0200
committerRoger Braun <roger@rogerbraun.net>2017-08-01 17:35:19 +0200
commit25c733f4022f171a69cff9badfa8d625a3ad5b6b (patch)
treeae1702dac3834a9272bf39e8dd5628ff7b9f917c /lib
parentf226f46a097b6b87a87ce1ead07383e8f83ad8ea (diff)
downloadpleroma-25c733f4022f171a69cff9badfa8d625a3ad5b6b.tar.gz
Add href to in-reply-to.
THis should enable fetching from pleroma posts.
Diffstat (limited to 'lib')
-rw-r--r--lib/pleroma/web/ostatus/activity_representer.ex12
1 files changed, 10 insertions, 2 deletions
diff --git a/lib/pleroma/web/ostatus/activity_representer.ex b/lib/pleroma/web/ostatus/activity_representer.ex
index a129fac23..842e44ee4 100644
--- a/lib/pleroma/web/ostatus/activity_representer.ex
+++ b/lib/pleroma/web/ostatus/activity_representer.ex
@@ -1,10 +1,18 @@
defmodule Pleroma.Web.OStatus.ActivityRepresenter do
- alias Pleroma.{Activity, User}
+ alias Pleroma.{Activity, User, Object}
alias Pleroma.Web.OStatus.UserRepresenter
require Logger
+ defp get_href(id) do
+ with %Object{data: %{ "external_url" => external_url } }<- Object.get_cached_by_ap_id(id) do
+ external_url
+ else
+ _e -> id
+ end
+ end
+
defp get_in_reply_to(%{"object" => %{"inReplyTo" => in_reply_to}}) do
- [{:"thr:in-reply-to", [ref: to_charlist(in_reply_to)], []}]
+ [{:"thr:in-reply-to", [ref: to_charlist(in_reply_to), href: to_charlist(get_href(in_reply_to))], []}]
end
defp get_in_reply_to(_), do: []