add rss links to anonymous homepages
This commit is contained in:
parent
cf3c4fd743
commit
c38ba8acdd
|
@ -11,7 +11,10 @@ class ListController < ApplicationController
|
|||
user = list_target_user
|
||||
list = TopicQuery.new(user, list_opts).public_send("list_#{filter}")
|
||||
list.more_topics_url = url_for(self.public_send "#{filter}_path".to_sym, list_opts.merge(format: 'json', page: next_page))
|
||||
@description = SiteSetting.site_description if [:latest, :hot].include?(filter)
|
||||
if [:latest, :hot].include?(filter)
|
||||
@description = SiteSetting.site_description
|
||||
@rss = filter
|
||||
end
|
||||
|
||||
respond(list)
|
||||
end
|
||||
|
|
|
@ -10,6 +10,12 @@
|
|||
|
||||
<p><%= t 'powered_by_html' %></p>
|
||||
|
||||
<% if @rss %>
|
||||
<% content_for :head do %>
|
||||
<%= auto_discovery_link_tag(:rss, {action: "#{@rss}_feed"}, title: I18n.t("rss_description.#{@rss}")) %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
<% if @category %>
|
||||
<% content_for :head do %>
|
||||
<%= auto_discovery_link_tag(@category, {action: :category_feed, format: :rss}, title: t('rss_topics_in_category', category: @category.name), type: 'application/rss+xml') %>
|
||||
|
|
|
@ -197,7 +197,7 @@ Discourse::Application.routes.draw do
|
|||
get 'popular/more' => 'list#popular_redirect'
|
||||
|
||||
[:latest, :hot].each do |filter|
|
||||
get "#{filter}.rss" => "list##{filter}_feed", format: :rss, as: "#{filter}_feed", filter: filter
|
||||
get "#{filter}.rss" => "list##{filter}_feed", format: :rss
|
||||
end
|
||||
|
||||
[:latest, :hot, :favorited, :read, :posted, :unread, :new].each do |filter|
|
||||
|
|
|
@ -36,6 +36,20 @@ describe ListController do
|
|||
|
||||
end
|
||||
|
||||
describe 'RSS feeds' do
|
||||
|
||||
[:latest, :hot].each do |filter|
|
||||
|
||||
it 'renders RSS' do
|
||||
get "#{filter}_feed", format: :rss
|
||||
response.should be_success
|
||||
response.content_type.should == 'application/rss+xml'
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
context 'category' do
|
||||
|
||||
context 'in a category' do
|
||||
|
|
Loading…
Reference in New Issue