about summary refs log tree commit diff
path: root/app/views/atom/user_stream.xml.ruby
diff options
context:
space:
mode:
Diffstat (limited to 'app/views/atom/user_stream.xml.ruby')
-rw-r--r--app/views/atom/user_stream.xml.ruby13
1 files changed, 11 insertions, 2 deletions
diff --git a/app/views/atom/user_stream.xml.ruby b/app/views/atom/user_stream.xml.ruby
index d058d5cb4..398464a9c 100644
--- a/app/views/atom/user_stream.xml.ruby
+++ b/app/views/atom/user_stream.xml.ruby
@@ -1,5 +1,5 @@
 Nokogiri::XML::Builder.new do |xml|
-  xml.feed(xmlns: 'http://www.w3.org/2005/Atom', 'xmlns:thr': 'http://purl.org/syndication/thread/1.0', 'xmlns:activity': 'http://activitystrea.ms/spec/1.0/') do
+  xml.feed(xmlns: 'http://www.w3.org/2005/Atom', 'xmlns:thr': 'http://purl.org/syndication/thread/1.0', 'xmlns:activity': 'http://activitystrea.ms/spec/1.0/', 'xmlns:poco': 'http://portablecontacts.net/spec/1.0') do
     xml.id_ atom_user_stream_url(id: @account.id)
     xml.title @account.display_name
     xml.subtitle @account.note
@@ -12,6 +12,10 @@ Nokogiri::XML::Builder.new do |xml|
       xml.summary @account.note
 
       xml.link(rel: 'alternate', type: 'text/html', href: profile_url(name: @account.username))
+
+      xml['poco'].preferredUsername @account.username
+      xml['poco'].displayName @account.display_name
+      xml['poco'].note @account.note
     end
 
     xml.link(rel: 'alternate', type: 'text/html', href: profile_url(name: @account.username))
@@ -19,7 +23,7 @@ Nokogiri::XML::Builder.new do |xml|
     xml.link(rel: 'salmon', href: salmon_url(@account))
     xml.link(rel: 'self', type: 'application/atom+xml', href: atom_user_stream_url(id: @account.id))
 
-    @account.stream_entries.each do |stream_entry|
+    @account.stream_entries.order('id desc').each do |stream_entry|
       xml.entry do
         xml.id_ unique_tag(stream_entry.created_at, stream_entry.activity_id, stream_entry.activity_type)
 
@@ -34,10 +38,15 @@ Nokogiri::XML::Builder.new do |xml|
           xml['activity'].send('object') do
             xml['activity'].send('object-type', "http://activitystrea.ms/schema/1.0/#{stream_entry.target.object_type}")
             xml.id_ stream_entry.target.uri
+            xml.title stream_entry.target.title
+            xml.summary stream_entry.target.summary
+            xml.link(rel: 'alternate', type: 'text/html', href: stream_entry.target.uri)
           end
         else
           xml['activity'].send('object-type', "http://activitystrea.ms/schema/1.0/#{stream_entry.object_type}")
         end
+
+        xml.link(rel: 'self', type: 'application/atom+xml', href: atom_entry_url(id: stream_entry.id))
       end
     end
   end