summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGo MAEDA <maeda@farend.jp>2022-11-01 03:24:17 +0000
committerGo MAEDA <maeda@farend.jp>2022-11-01 03:24:17 +0000
commitdcdf27b8958606b6a6893c4b754ef2c97c3c0313 (patch)
tree88a9645177195be18a88d8abca62f364cefac53d
parente1928aaf1944559ce3fd5594fe0988d42719c689 (diff)
downloadredmine-dcdf27b8958606b6a6893c4b754ef2c97c3c0313.tar.gz
redmine-dcdf27b8958606b6a6893c4b754ef2c97c3c0313.zip
Render all visible projects in robots.txt (including closed projects) (#37807).
Patch by Holger Just. git-svn-id: https://svn.redmine.org/redmine/trunk@21938 e93f8b46-1217-0410-a6f0-8f06a7374b81
-rw-r--r--app/controllers/welcome_controller.rb2
-rw-r--r--test/integration/welcome_test.rb5
2 files changed, 6 insertions, 1 deletions
diff --git a/app/controllers/welcome_controller.rb b/app/controllers/welcome_controller.rb
index a32a944a4..e526fe5b1 100644
--- a/app/controllers/welcome_controller.rb
+++ b/app/controllers/welcome_controller.rb
@@ -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
diff --git a/test/integration/welcome_test.rb b/test/integration/welcome_test.rb
index 4337a5a50..ffb3e240f 100644
--- a/test/integration/welcome_test.rb
+++ b/test/integration/welcome_test.rb
@@ -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