Add attachments to feed.
This commit is contained in:
parent
a2b79ce7d1
commit
ece85fc8bc
|
@ -7,6 +7,11 @@ def to_simple_form(%{data: %{"object" => %{"type" => "Note"}}} = activity, user)
|
||||||
inserted_at = activity.inserted_at
|
inserted_at = activity.inserted_at
|
||||||
|> NaiveDateTime.to_iso8601
|
|> 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:object-type", ['http://activitystrea.ms/schema/1.0/note']},
|
||||||
{:"activity:verb", ['http://activitystrea.ms/schema/1.0/post']},
|
{:"activity:verb", ['http://activitystrea.ms/schema/1.0/post']},
|
||||||
|
@ -15,6 +20,6 @@ def to_simple_form(%{data: %{"object" => %{"type" => "Note"}}} = activity, user)
|
||||||
{:content, [type: 'html'], h.(activity.data["object"]["content"])},
|
{:content, [type: 'html'], h.(activity.data["object"]["content"])},
|
||||||
{:published, h.(inserted_at)},
|
{:published, h.(inserted_at)},
|
||||||
{:updated, h.(updated_at)}
|
{:updated, h.(updated_at)}
|
||||||
]
|
] ++ attachments
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue