about summary refs log tree commit diff
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2016-10-10 14:22:09 +0200
committerEugen Rochko <eugen@zeonfederated.com>2016-10-10 14:22:09 +0200
commitf249a8c187226c02463e1f91c716cff5ba4b4080 (patch)
tree41cae11dc807d34b4ca4db7b75d3dc71d6d83b46
parent65ae9637d6cc7a9d351e8f83993ef138a01b1485 (diff)
Include mentions and media attachments of reblogged posts in Atom
-rw-r--r--app/helpers/atom_builder_helper.rb13
1 files changed, 10 insertions, 3 deletions
diff --git a/app/helpers/atom_builder_helper.rb b/app/helpers/atom_builder_helper.rb
index c1ca8c619..343562569 100644
--- a/app/helpers/atom_builder_helper.rb
+++ b/app/helpers/atom_builder_helper.rb
@@ -149,6 +149,7 @@ module AtomBuilderHelper
     verb           xml, stream_entry.verb
     link_self      xml, account_stream_entry_url(stream_entry.account, stream_entry, format: 'atom')
     link_alternate xml, account_stream_entry_url(stream_entry.account, stream_entry)
+    object_type    xml, stream_entry.object_type
 
     # Comments need thread element
     if stream_entry.threaded?
@@ -167,7 +168,7 @@ module AtomBuilderHelper
         end
 
         # Statuses have content and author
-        if [:note, :comment].include? stream_entry.target.object_type
+        if stream_entry.target.is_a?(Status)
           content      xml, conditionally_formatted(stream_entry.target)
           verb         xml, stream_entry.target.verb
           published_at xml, stream_entry.target.created_at
@@ -176,10 +177,16 @@ module AtomBuilderHelper
           author(xml) do
             include_author xml, stream_entry.target.account
           end
+
+          stream_entry.target.mentions.each do |mentioned|
+            link_mention xml, mentioned
+          end
+
+          stream_entry.target.media_attachments.each do |media|
+            link_enclosure xml, media
+          end
         end
       end
-    else
-      object_type xml, stream_entry.object_type
     end
 
     stream_entry.mentions.each do |mentioned|