Skip to content

Commit a430975

Browse files
committed
Ensure sitemap loads for anonymous user
1 parent 472b25d commit a430975

2 files changed

Lines changed: 5 additions & 0 deletions

File tree

app/controllers/sitemaps_controller.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
class SitemapsController < ApplicationController
2+
skip_before_action :authenticate_user!, :authenticate_user_from_token!
3+
24
def index
35
if TeSS::Config.feature['spaces'] && !current_space.default?
46
render file: sitemap_base.join("#{current_space.host}/sitemap.xml"), layout: false

test/controllers/sitemaps_controller_test.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ class SitemapsControllerTest < ActionController::TestCase
44
include Devise::Test::ControllerHelpers
55

66
test 'renders global sitemap when spaces feature is disabled' do
7+
sign_out :user
8+
assert User.current_user.nil? # Should work anonymously
9+
710
with_settings(feature: { spaces: false }) do
811
get :index
912
end

0 commit comments

Comments
 (0)