From d6e665f8888b5a57d9c104be5db1712a7f3be20f Mon Sep 17 00:00:00 2001 From: Alexander Date: Fri, 1 Mar 2013 13:56:14 -0800 Subject: [PATCH] Caching for topic/category RSS feeds Using anonymous_etag() now --- app/controllers/list_controller.rb | 9 ++++++--- app/controllers/topics_controller.rb | 5 +++-- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/app/controllers/list_controller.rb b/app/controllers/list_controller.rb index 3de4a30ac76..e101e2769e8 100644 --- a/app/controllers/list_controller.rb +++ b/app/controllers/list_controller.rb @@ -51,14 +51,17 @@ class ListController < ApplicationController raise Discourse::InvalidParameters.new('Category RSS of "uncategorized"') if params[:category] == Slug.for(SiteSetting.uncategorized_name) || params[:category] == SiteSetting.uncategorized_name @category = Category.where("slug = ?", params[:category]).includes(:featured_users).first + guardian.ensure_can_see!(@category) - @topic_list = TopicQuery.new.list_new_in_category(@category) - render 'list', formats: [:rss] + + anonymous_etag(@category) do + @topic_list = TopicQuery.new.list_new_in_category(@category) + render 'list', formats: [:rss] + end end protected - def respond(list) list.draft_key = Draft::NEW_TOPIC diff --git a/app/controllers/topics_controller.rb b/app/controllers/topics_controller.rb index 80e8a8ccea0..417fd647203 100644 --- a/app/controllers/topics_controller.rb +++ b/app/controllers/topics_controller.rb @@ -83,7 +83,6 @@ class TopicsController < ApplicationController toggle_mute(false) end - def destroy topic = Topic.where(id: params[:id]).first guardian.ensure_can_delete!(topic) @@ -143,7 +142,9 @@ class TopicsController < ApplicationController def feed @topic_view = TopicView.new(params[:topic_id]) - render 'topics/show', formats: [:rss] + anonymous_etag(@topic_view.topic) do + render 'topics/show', formats: [:rss] + end end private