]> source.dussan.org Git - redmine.git/commitdiff
Render all visible projects in robots.txt (including closed projects) (#37807).
authorGo MAEDA <maeda@farend.jp>
Tue, 1 Nov 2022 03:24:17 +0000 (03:24 +0000)
committerGo MAEDA <maeda@farend.jp>
Tue, 1 Nov 2022 03:24:17 +0000 (03:24 +0000)
Patch by Holger Just.

git-svn-id: https://svn.redmine.org/redmine/trunk@21938 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/controllers/welcome_controller.rb
test/integration/welcome_test.rb

index a32a944a40d1e4ec8f5a7312b9e4aba8093c334c..e526fe5b1c0163c1ccd51121e1adc72276ac4cd5 100644 (file)
@@ -25,7 +25,7 @@ class WelcomeController < ApplicationController
   end
 
   def robots
-    @projects = Project.all_public.active
+    @projects = Project.visible(User.anonymous)
     render :layout => false, :content_type => 'text/plain'
   end
 end
index 4337a5a50d1a006338a935a12973f93c8110d3b5..ffb3e240f7b4e94c2e998c0e888fcaaa53affa6c 100644 (file)
@@ -24,6 +24,8 @@ class WelcomeTest < Redmine::IntegrationTest
            :projects, :enabled_modules, :members, :member_roles, :roles
 
   def test_robots
+    Project.find(3).update_attribute :status, Project::STATUS_CLOSED
+
     get '/robots.txt'
     assert_response :success
     assert_equal 'text/plain', @response.media_type
@@ -36,5 +38,8 @@ class WelcomeTest < Redmine::IntegrationTest
     assert @response.body.match(%r{^Disallow: /login\r?$})
     assert @response.body.match(%r{^Disallow: /account/register\r?$})
     assert @response.body.match(%r{^Disallow: /account/lost_password\r?$})
+
+    # closed projects are included in the list
+    assert @response.body.match(%r{^Disallow: /projects/subproject1/issues\r?$})
   end
 end