From 14ed917baa229dffbe038bfad5bced0f386cfd41 Mon Sep 17 00:00:00 2001 From: joshua stein Date: Sun, 13 Jan 2013 21:39:52 -0600 Subject: [PATCH] show rss header on /comments --- app/controllers/application_controller.rb | 6 ++++++ app/controllers/comments_controller.rb | 7 +++++++ app/controllers/home_controller.rb | 6 ------ 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 59ffd74..3c1c843 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -58,4 +58,10 @@ class ApplicationController < ActionController::Base def user_is_spider? !!request.env["HTTP_USER_AGENT"].to_s.match(/Googlebot/) end + + def find_user_from_rss_token + if !@user && request[:format] == "rss" && params[:token].to_s.present? + @user = User.find_by_rss_token(params[:token]) + end + end end diff --git a/app/controllers/comments_controller.rb b/app/controllers/comments_controller.rb index b29375b..8641b1b 100644 --- a/app/controllers/comments_controller.rb +++ b/app/controllers/comments_controller.rb @@ -3,6 +3,9 @@ class CommentsController < ApplicationController before_filter :require_logged_in_user_or_400, :only => [ :create, :preview, :preview_new, :upvote, :downvote, :unvote ] + + # for rss feeds, load the user's tag filters if a token is passed + before_filter :find_user_from_rss_token, :only => [ :index ] def create if !(story = Story.find_by_short_id(params[:story_id])) || story.is_gone? @@ -187,6 +190,10 @@ class CommentsController < ApplicationController end def index + @rss_link ||= "" + @heading = @title = "Newest Comments" @cur_url = "/comments" diff --git a/app/controllers/home_controller.rb b/app/controllers/home_controller.rb index 882995c..508551a 100644 --- a/app/controllers/home_controller.rb +++ b/app/controllers/home_controller.rb @@ -187,10 +187,4 @@ private [ stories, show_more ] end - - def find_user_from_rss_token - if !@user && request[:format] == "rss" && params[:token].to_s.present? - @user = User.find_by_rss_token(params[:token]) - end - end end