Project

General

Profile

Feature #37807 » 0001-Render-all-visible-projects-in-robots.txt-including-.patch

Holger Just, 2022-10-20 17:27

View differences:

app/controllers/welcome_controller.rb
25 25
  end
26 26

  
27 27
  def robots
28
    @projects = Project.all_public.active
28
    @projects = Project.visible(User.anonymous)
29 29
    render :layout => false, :content_type => 'text/plain'
30 30
  end
31 31
end
test/integration/welcome_test.rb
24 24
           :projects, :enabled_modules, :members, :member_roles, :roles
25 25

  
26 26
  def test_robots
27
    Project.find(3).update_attribute :status, Project::STATUS_CLOSED
28

  
27 29
    get '/robots.txt'
28 30
    assert_response :success
29 31
    assert_equal 'text/plain', @response.media_type
......
36 38
    assert @response.body.match(%r{^Disallow: /login\r?$})
37 39
    assert @response.body.match(%r{^Disallow: /account/register\r?$})
38 40
    assert @response.body.match(%r{^Disallow: /account/lost_password\r?$})
41

  
42
    # closed projects are included in the list
43
    assert @response.body.match(%r{^Disallow: /projects/subproject1/issues\r?$})
39 44
  end
40 45
end
(2-2/3)