mirror of
https://github.com/redmine/redmine.git
synced 2025-11-13 08:46:01 +01:00
Include closed projects in search for scope subprojects (#28636).
Patch by Marius BALTEANU. git-svn-id: http://svn.redmine.org/redmine/trunk@17692 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
@@ -49,7 +49,7 @@ class SearchController < ApplicationController
|
|||||||
when 'my_projects'
|
when 'my_projects'
|
||||||
User.current.projects
|
User.current.projects
|
||||||
when 'subprojects'
|
when 'subprojects'
|
||||||
@project ? (@project.self_and_descendants.active.to_a) : nil
|
@project ? (@project.self_and_descendants.to_a) : nil
|
||||||
else
|
else
|
||||||
@project
|
@project
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -338,6 +338,46 @@ class SearchControllerTest < Redmine::ControllerTest
|
|||||||
assert_response 404
|
assert_response 404
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_search_should_include_closed_projects
|
||||||
|
@request.session[:user_id] = 1
|
||||||
|
|
||||||
|
project = Project.find(5)
|
||||||
|
project.close
|
||||||
|
project.save
|
||||||
|
|
||||||
|
# scope all
|
||||||
|
get :index, :params => {:q => 'Issue of a private subproject', :scope => 'all'}
|
||||||
|
assert_response :success
|
||||||
|
|
||||||
|
assert_select '#search-results' do
|
||||||
|
assert_select 'dt.issue', :text => /Bug #6/
|
||||||
|
end
|
||||||
|
|
||||||
|
# scope my_projects
|
||||||
|
get :index, :params => {:q => 'Issue of a private subproject', :scope => 'my_projects'}
|
||||||
|
assert_response :success
|
||||||
|
|
||||||
|
assert_select '#search-results' do
|
||||||
|
assert_select 'dt.issue', :text => /Bug #6/
|
||||||
|
end
|
||||||
|
|
||||||
|
# scope subprojects
|
||||||
|
get :index, :params => {:id => 1, :q => 'Issue of a private subproject', :scope => 'subprojects'}
|
||||||
|
assert_response :success
|
||||||
|
|
||||||
|
assert_select '#search-results' do
|
||||||
|
assert_select 'dt.issue', :text => /Bug #6/
|
||||||
|
end
|
||||||
|
|
||||||
|
# scope project
|
||||||
|
get :index, :params => {:id => 5, :q => 'Issue of a private subproject'}
|
||||||
|
assert_response :success
|
||||||
|
|
||||||
|
assert_select '#search-results' do
|
||||||
|
assert_select 'dt.issue', :text => /Bug #6/
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def test_quick_jump_to_issue
|
def test_quick_jump_to_issue
|
||||||
# issue of a public project
|
# issue of a public project
|
||||||
get :index, :params => {:q => "3"}
|
get :index, :params => {:q => "3"}
|
||||||
|
|||||||
Reference in New Issue
Block a user