From ece85fc8bc18a67079179922cf728786c1c444e6 Mon Sep 17 00:00:00 2001 From: Roger Braun Date: Sat, 22 Apr 2017 12:09:13 +0200 Subject: [PATCH] Add attachments to feed. --- lib/pleroma/web/ostatus/activity_representer.ex | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/pleroma/web/ostatus/activity_representer.ex b/lib/pleroma/web/ostatus/activity_representer.ex index 6f101109c..daaa4ef03 100644 --- a/lib/pleroma/web/ostatus/activity_representer.ex +++ b/lib/pleroma/web/ostatus/activity_representer.ex @@ -7,6 +7,11 @@ defmodule Pleroma.Web.OStatus.ActivityRepresenter do inserted_at = activity.inserted_at |> NaiveDateTime.to_iso8601 + attachments = Enum.map(activity.data["object"]["attachment"] || [], fn(attachment) -> + url = hd(attachment["url"]) + {:link, [rel: 'enclosure', href: to_charlist(url["href"]), type: to_charlist(url["mediaType"])], []} + end) + [ {:"activity:object-type", ['http://activitystrea.ms/schema/1.0/note']}, {:"activity:verb", ['http://activitystrea.ms/schema/1.0/post']}, @@ -15,6 +20,6 @@ defmodule Pleroma.Web.OStatus.ActivityRepresenter do {:content, [type: 'html'], h.(activity.data["object"]["content"])}, {:published, h.(inserted_at)}, {:updated, h.(updated_at)} - ] + ] ++ attachments end end -- 2.45.2