FIX: wrong category links on subfolder install in rss feed for a category topic list

This commit is contained in:
Neil Lalonde 2018-09-07 10:03:30 -04:00
parent fb96ab4464
commit 9e77fd8fc3
2 changed files with 11 additions and 2 deletions

View File

@ -219,8 +219,8 @@ class ListController < ApplicationController
discourse_expires_in 1.minute
@title = "#{@category.name} - #{SiteSetting.title}"
@link = "#{Discourse.base_url}#{@category.url}"
@atom_link = "#{Discourse.base_url}#{@category.url}.rss"
@link = "#{Discourse.base_url_no_prefix}#{@category.url}"
@atom_link = "#{Discourse.base_url_no_prefix}#{@category.url}.rss"
@description = "#{I18n.t('topics_in_category', category: @category.name)} #{@category.description}"
@topic_list = TopicQuery.new(current_user).list_new_in_category(@category)

View File

@ -393,6 +393,15 @@ RSpec.describe ListController do
expect(response.status).to eq(200)
expect(response.content_type).to eq('application/rss+xml')
end
it "renders RSS in subfolder correctly" do
GlobalSetting.stubs(:relative_url_root).returns('/forum')
Discourse.stubs(:base_uri).returns("/forum")
get "/c/#{category.slug}.rss"
expect(response.status).to eq(200)
expect(response.body).to_not include("/forum/forum")
expect(response.body).to include("http://test.localhost/forum/c/#{category.slug}")
end
end
describe "category default views" do