Merge pull request #319 from alxndr/rss-caching
Basic caching for topic/category RSS feeds
This commit is contained in:
commit
3cf3fee781
|
@ -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
|
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
|
@category = Category.where("slug = ?", params[:category]).includes(:featured_users).first
|
||||||
|
|
||||||
guardian.ensure_can_see!(@category)
|
guardian.ensure_can_see!(@category)
|
||||||
|
|
||||||
|
anonymous_etag(@category) do
|
||||||
@topic_list = TopicQuery.new.list_new_in_category(@category)
|
@topic_list = TopicQuery.new.list_new_in_category(@category)
|
||||||
render 'list', formats: [:rss]
|
render 'list', formats: [:rss]
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
protected
|
protected
|
||||||
|
|
||||||
|
|
||||||
def respond(list)
|
def respond(list)
|
||||||
|
|
||||||
list.draft_key = Draft::NEW_TOPIC
|
list.draft_key = Draft::NEW_TOPIC
|
||||||
|
|
|
@ -83,7 +83,6 @@ class TopicsController < ApplicationController
|
||||||
toggle_mute(false)
|
toggle_mute(false)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
def destroy
|
def destroy
|
||||||
topic = Topic.where(id: params[:id]).first
|
topic = Topic.where(id: params[:id]).first
|
||||||
guardian.ensure_can_delete!(topic)
|
guardian.ensure_can_delete!(topic)
|
||||||
|
@ -143,8 +142,10 @@ class TopicsController < ApplicationController
|
||||||
|
|
||||||
def feed
|
def feed
|
||||||
@topic_view = TopicView.new(params[:topic_id])
|
@topic_view = TopicView.new(params[:topic_id])
|
||||||
|
anonymous_etag(@topic_view.topic) do
|
||||||
render 'topics/show', formats: [:rss]
|
render 'topics/show', formats: [:rss]
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue