diff options
author | Eugen Rochko <eugen@zeonfederated.com> | 2016-09-05 18:57:59 +0200 |
---|---|---|
committer | Eugen Rochko <eugen@zeonfederated.com> | 2016-09-05 18:57:59 +0200 |
commit | 1d9c886518ab389917ddf3f6c73daa31536d7fe9 (patch) | |
tree | 3d3bc62cf62eca1d741dcd78841471988a3039b8 /app/helpers | |
parent | eec0dc46a6d6782f6aebdc759d4822ef17fd57a2 (diff) |
Adding enclosures to Atom and statuses JSON
Diffstat (limited to 'app/helpers')
-rw-r--r-- | app/helpers/atom_builder_helper.rb | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/app/helpers/atom_builder_helper.rb b/app/helpers/atom_builder_helper.rb index a98cb7b3b..ea54b9fdb 100644 --- a/app/helpers/atom_builder_helper.rb +++ b/app/helpers/atom_builder_helper.rb @@ -125,6 +125,10 @@ module AtomBuilderHelper xml.link(rel: 'mentioned', href: uri_for_target(account)) end + def link_enclosure(xml, media) + xml.link(rel: 'enclosure', href: full_asset_url(media.file.url), type: media.file_content_type, length: media.file_size) + end + def link_avatar(xml, account) single_link_avatar(xml, account, :large, 300) single_link_avatar(xml, account, :medium, 96) @@ -205,6 +209,12 @@ module AtomBuilderHelper stream_entry.mentions.each do |mentioned| link_mention xml, mentioned end + + if stream_entry.activity.is_a?(Status) + stream_entry.activity.media_attachments.each do |media| + link_enclosure xml, media + end + end end private |