about summary refs log tree commit diff
path: root/app/views
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2016-02-23 19:17:37 +0100
committerEugen Rochko <eugen@zeonfederated.com>2016-02-23 19:17:37 +0100
commitfa33750105389110a3395ca19167f789d21a149e (patch)
tree4b121a067ad46be5189301a2e3e3b2bcef8d6426 /app/views
parent3b0bc18db928c455186273d9b9aa5b96d91e035e (diff)
Adding reblogs, favourites, improving atom generation
Diffstat (limited to 'app/views')
-rw-r--r--app/views/atom/entry.xml.ruby34
-rw-r--r--app/views/atom/user_stream.xml.ruby31
2 files changed, 5 insertions, 60 deletions
diff --git a/app/views/atom/entry.xml.ruby b/app/views/atom/entry.xml.ruby
index 2a26e624a..e0e089f46 100644
--- a/app/views/atom/entry.xml.ruby
+++ b/app/views/atom/entry.xml.ruby
@@ -1,37 +1,9 @@
 Nokogiri::XML::Builder.new do |xml|
   entry(xml, true) do
-    unique_id    xml, @entry.created_at, @entry.activity_id, @entry.activity_type
-    published_at xml, @entry.activity.created_at
-    updated_at   xml, @entry.activity.updated_at
-    title        xml, @entry.title
-    content      xml, @entry.content
-    verb         xml, @entry.verb
-
     author(xml) do
-      object_type      xml, :person
-      uri              xml, profile_url(name: @entry.account.username)
-      name             xml, @entry.account.username
-      summary          xml, @entry.account.note
-      link_alternate   xml, profile_url(name: @entry.account.username)
-      portable_contact xml, @entry.account
-    end
-
-    if @entry.targeted?
-      target(xml) do
-        object_type    xml, @entry.target.object_type
-        simple_id      xml, @entry.target.uri
-        title          xml, @entry.target.title
-        summary        xml, @entry.target.summary
-        link_alternate xml, @entry.target.uri
-
-        if @entry.target.object_type == :person
-          portable_contact xml, @entry.target
-        end
-      end
-    else
-      object_type xml, @entry.object_type
+      include_author xml, @entry.account
     end
 
-    link_self xml, atom_entry_url(id: @entry.id)
+    include_entry xml, @entry
   end
-end
+end.to_xml
diff --git a/app/views/atom/user_stream.xml.ruby b/app/views/atom/user_stream.xml.ruby
index 2b0c0aaa0..d7e0d5843 100644
--- a/app/views/atom/user_stream.xml.ruby
+++ b/app/views/atom/user_stream.xml.ruby
@@ -6,12 +6,7 @@ Nokogiri::XML::Builder.new do |xml|
     updated_at xml, stream_updated_at
 
     author(xml) do
-      object_type      xml, :person
-      uri              xml, profile_url(name: @account.username)
-      name             xml, @account.username
-      summary          xml, @account.note
-      link_alternate   xml, profile_url(name: @account.username)
-      portable_contact xml, @account
+      include_author xml, @account
     end
 
     link_alternate xml, profile_url(name: @account.username)
@@ -21,29 +16,7 @@ Nokogiri::XML::Builder.new do |xml|
 
     @account.stream_entries.order('id desc').each do |stream_entry|
       entry(xml, false) do
-        unique_id    xml, stream_entry.created_at, stream_entry.activity_id, stream_entry.activity_type
-        published_at xml, stream_entry.activity.created_at
-        updated_at   xml, stream_entry.activity.updated_at
-        title        xml, stream_entry.title
-        content      xml, stream_entry.content
-        verb         xml, stream_entry.verb
-        link_self    xml, atom_entry_url(id: stream_entry.id)
-
-        if stream_entry.targeted?
-          target(xml) do
-            object_type    xml, stream_entry.target.object_type
-            simple_id      xml, stream_entry.target.uri
-            title          xml, stream_entry.target.title
-            summary        xml, stream_entry.target.summary
-            link_alternate xml, stream_entry.target.uri
-
-            if stream_entry.target.object_type == :person
-              portable_contact xml, stream_entry.target
-            end
-          end
-        else
-          object_type xml, stream_entry.object_type
-        end
+        include_entry xml, stream_entry
       end
     end
   end