From c124a9ab41bb25efcf5525a649f5909b10b5080b Mon Sep 17 00:00:00 2001 From: maxwell <maxwell@joindiaspora.com> Date: Fri, 16 Jul 2010 16:07:58 -0700 Subject: [PATCH] IZ MS blogs ctivity streams/atom --- app/controllers/blogs_controller.rb | 7 ++++--- lib/common.rb | 17 +++++++++++++++++ 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/app/controllers/blogs_controller.rb b/app/controllers/blogs_controller.rb index 5bc4a5355e..4a548de06d 100644 --- a/app/controllers/blogs_controller.rb +++ b/app/controllers/blogs_controller.rb @@ -4,9 +4,10 @@ class BlogsController < ApplicationController def index @blogs = Blog.paginate :page => params[:page], :order => 'created_at DESC' - format.html - format.atom {render :xml => Diaspora::XML::generate(:current_url => request.url, :objects => @bookmarks)} - + respond_to do |format| + format.html + format.atom {render :xml => Diaspora::XML::generate(:current_url => request.url, :objects => @blogs)} + end end diff --git a/lib/common.rb b/lib/common.rb index d4a9b8cd95..db626a9637 100644 --- a/lib/common.rb +++ b/lib/common.rb @@ -188,6 +188,23 @@ module Diaspora XML end + + def self.Blog_build_entry(blog) + <<-XML +<entry> +<activity:verb>http://activitystrea.ms/schema/1.0/post</activity:verb> +<title>#{blog.title}</title> +<content>#{blog.body}</content> +<permalink> +<link rel="alternate" type="text/html" href="#{OWNER.url}blogs/#{blog.id}"/> +</permalink> +<id>#{OWNER.url}blogs/#{blog.id}</id> +<published>#{blog.created_at.xmlschema}</published> +<updated>#{blog.updated_at.xmlschema}</updated> +</entry> + XML + end + def self.footer <<-XML.strip </feed> -- GitLab