diff --git a/app/controllers/comments_controller.rb b/app/controllers/comments_controller.rb index 0ef4394..0b1ef4c 100644 --- a/app/controllers/comments_controller.rb +++ b/app/controllers/comments_controller.rb @@ -1,6 +1,8 @@ class CommentsController < ApplicationController COMMENTS_PER_PAGE = 20 + # for rss feeds, load the user's tag filters if a token is passed + before_filter :find_user_from_rss_token, :only => [ :index ] before_filter :require_logged_in_user_or_400, :only => [ :create, :preview, :upvote, :downvote, :unvote ] @@ -221,6 +223,17 @@ class CommentsController < ApplicationController end end end + + respond_to do |format| + format.html { render :action => "index" } + format.rss { + if @user && params[:token].present? + @title = "Private comments feed for #{@user.username}" + end + + render :action => "index.rss", :layout => false + } + end end def threads diff --git a/app/controllers/home_controller.rb b/app/controllers/home_controller.rb index 1cd568c..e0c31c9 100644 --- a/app/controllers/home_controller.rb +++ b/app/controllers/home_controller.rb @@ -42,6 +42,8 @@ class HomeController < ApplicationController @rss_link ||= { :title => "RSS 2.0", :href => "/rss#{@user ? "?token=#{@user.rss_token}" : ""}" } + @comments_rss_link ||= { :title => "Comments - RSS 2.0", + :href => "/comments.rss#{@user ? "?token=#{@user.rss_token}" : ""}" } @heading = @title = "" @cur_url = "/" diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 66a0544..90481cb 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -29,6 +29,11 @@ <% end %> + <% if @comments_rss_link %> + + <% end %>
diff --git a/config/routes.rb b/config/routes.rb index aa5b744..dd864ae 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -73,6 +73,7 @@ Lobsters::Application.routes.draw do end end get "/comments/page/:page" => "comments#index" + get "/comments" => "comments#index", :format => /html|rss/ get "/messages/sent" => "messages#sent" post "/messages/batch_delete" => "messages#batch_delete",